- use type:raw instead of type:plain when setting label #25
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 Build | |
# Controls when the workflow will run | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- '*.*.*' | |
pull_request: | |
branches: | |
- 'master' | |
jobs: | |
build-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
# Get the repository's code | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# https://github.com/docker/login-action | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# https://github.com/docker/metadata-action | |
- name: Docker meta | |
id: meta_webhook_docker | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
almir/webhook | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}},enable={{github.ref_type == 'tag'}} | |
type=raw,value=latest,enable={{github.ref_type == 'tag'}} | |
# https://github.com/docker/build-push-action | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta_webhook_docker.outputs.tags }} | |
labels: ${{ steps.meta_webhook_docker.outputs.labels }} |