Skip to content

Commit

Permalink
ci: Conditionning docker step with the presence of docker credentials
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Apr 11, 2021
1 parent 7dc637d commit 308570a
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
---
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
SCRIPTS_NO_INTERACTIVE: "true"

defaults:
run:
shell: bash

jobs:
build:
name: Golang
Expand All @@ -25,18 +30,14 @@ jobs:
make
git --no-pager diff -- ':(exclude)go.sum' && git diff --quiet -- ':(exclude)go.sum'
- uses: codecov/codecov-action@v1

package:
name: Docker
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
Expand All @@ -45,8 +46,24 @@ jobs:
run: |
curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/scripts/main/bootstrap" | bash -s "release"
./scripts/release build
DOCKER_IMAGE="${{ secrets.DOCKER_USER }}/$(make name)" IMAGE_VERSION="$(make version)" ./scripts/release docker
- name: Login to DockerHub
if: env.DOCKER_USER && env.DOCKER_PASS
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker
if: env.DOCKER_USER && env.DOCKER_PASS
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
run: |
DOCKER_IMAGE="${{ secrets.DOCKER_USER }}/$(make name)-notifier" IMAGE_VERSION="$(make version)" DOCKERFILE="Dockerfile.notifier" ./scripts/release docker
DOCKER_IMAGE="${{ secrets.DOCKER_USER }}/$(make name)" IMAGE_VERSION="$(make version)" ./scripts/release docker
publish:
name: Publish
if:
Expand Down

0 comments on commit 308570a

Please sign in to comment.