Only push to docker hub if the branch is master. #52
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build images | |
on: [push] | |
env: | |
IMAGE_NAME: fossa/haskell-static-alpine | |
jobs: | |
# Push image to Docker Hub using `fossabot` account. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
build-and-push: | |
name: ${{ matrix.ghc-version }}-build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ghc-version: | |
- ghc-8.8.4 | |
- ghc-8.10.7 | |
- ghc-9.0.2 | |
- ghc-9.4.7 | |
- ghc-9.4.8 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build image | |
run: docker build ./${{ matrix.ghc-version }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} | |
- name: Log into registry | |
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u fossabot --password-stdin | |
- name: Push image | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: docker push $IMAGE_NAME:${{ matrix.ghc-version }} |