push to container registry on dispatch too #21
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: Docker | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
#test building image for PR without push | |
test: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: FranzDiebold/[email protected] | |
- name: Build web image | |
shell: bash | |
run: docker build . | |
#build and push image | |
push: | |
runs-on: ubuntu-20.04 | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: FranzDiebold/[email protected] | |
- name: Build web image | |
shell: bash | |
run: docker build -t wycliffeassociates/install4j-docker:$GITHUB_SHA -t wycliffeassociates/install4j-docker:$GITHUB_REF_NAME -t wycliffeassociates/install4j-docker:latest . | |
- name: Log into registry | |
shell: bash | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_TOKEN }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USER }} | |
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
- name: Push image | |
run: | | |
docker push -a wycliffeassociates/install4j-docker |