update build-deploy.yaml #26
Workflow file for this run
This file contains hidden or 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 Build and Deploy Image | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| deploy: | |
| name: Build and Deploy Image | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKER_REPO_NAME: binarypatrick/header-audit | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Extract tag name | |
| id: vars | |
| run: echo "TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
| - name: Set Release Tag Variables | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| echo "DOCKER_IMAGE_TAGS=$DOCKER_REPO_NAME:${GITHUB_REF#refs/tags/v}, $DOCKER_REPO_NAME:latest" >> "$GITHUB_ENV" | |
| - name: Set Prerelease Tag Variables | |
| if: ${{ ! startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| echo "DOCKER_IMAGE_TAGS=$DOCKER_REPO_NAME:${{ github.sha }}, $DOCKER_REPO_NAME:prerelease" >> "$GITHUB_ENV" | |
| - name: Login to Dockerhub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| - name: Build and Push | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src | |
| push: true | |
| tags: ${{ env.DOCKER_IMAGE_TAGS }} | |
| build-args: | | |
| GIT_TAG=${{ env.TAG }} |