optionally push docker image at end of github action #7
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 Image CI | ||
on: | ||
push: | ||
branches: [ "*" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag anypay/web3-checkout:${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.head_ref }} | ||
- name: Push Docker Image | ||
if: github.event_name == 'push' && github.event_name != 'pull_request' | ||
run: | | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker push your-docker-username/your-docker-repo:latest |