Skip to content

Set latest tag for default branch push. #11

Set latest tag for default branch push.

Set latest tag for default branch push. #11

Workflow file for this run

name: Build
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Restore tools
run: dotnet tool restore
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKERHUB_REGISTRY }}/${{ vars.DOCKERHUB_IMAGE }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
- name: Build and push
run: dotnet cake --target Push --registry ${{ vars.DOCKERHUB_REGISTRY }} --image ${{ vars.DOCKERHUB_IMAGE }} --tag ${{ steps.meta.outputs.version }}