Skip to content

Commit

Permalink
github actions: Automate pushes to DockerHub
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKagstrom committed Nov 7, 2021
1 parent 18c6071 commit 644e51b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,24 @@ jobs:
chmod u+x .github/workflows/freebsd-build.sh .github/workflows/ci-run-tests.sh
.github/workflows/freebsd-build.sh x86_64
.github/workflows/ci-run-tests.sh
build-and-push-docker-image:
needs: [build-linux, build-osx, build-freebsd]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Docker Hub login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin

- name: Build docker image
run: docker build -t kcov/kcov:latest .

- name: Push to Docker Hub
run: docker push kcov/kcov:latest
27 changes: 26 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,34 @@ jobs:
name: kcov-${{ matrix.arch }}.tar.gz
path: kcov-${{ matrix.arch }}.tar.gz


build-and-push-docker-image:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Get git tag
id: tag
uses: dawidd6/action-get-tag@v1

- name: Docker Hub login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin

- name: Build docker image
run: docker build -t kcov/kcov:${{ steps.tag.outputs.tag }} .

- name: Push to Docker Hub
run: docker push kcov/kcov:${{ steps.tag.outputs.tag }}

create_release:
name: Create release
needs: build
needs: [build-and-push-docker-image]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
Expand Down

0 comments on commit 644e51b

Please sign in to comment.