Simplify tag list #3
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: prdeploy-api - Build | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
branches: | |
- main | |
paths: | |
- prdeploy-api/** | |
- .github/workflows/prdeploy-api-build.yaml | |
push: # TODO: Remove after testing. | |
branches: | |
- docker-builds | |
release: | |
types: | |
- created | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build image | |
runs-on: ubuntu-latest | |
concurrency: | |
group: build-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
DOCKER_BUILDKIT: 1 | |
HELM_EXPERIMENTAL_OCI: 1 | |
DOTNET_INSTALL_DIR: '~/.dotnet' | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: prdeploy-api | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ github.event_name == 'release' && github.event.action == 'created' }} | |
tags: ${{ (github.event_name == 'release' && github.release.tag_name) && format('greggbjensen/prdeploy-api:latest, greggbjensen/prdeploy-api:{0}', github.release.tag_name) || 'greggbjensen/prdeploy-api:test' }} | |
file: prdeploy-api/src/PrDeploy.Api/Dockerfile | |
context: prdeploy-api |