try to fix push problems #4 #42
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: Build Docker Image | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*.*.*" | |
- "Release_*" | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
actions: write | |
jobs: | |
docker: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- tag: "" | |
suffix: "-ubuntu" | |
is_default: true | |
platforms: linux/amd64,linux/arm64 | |
- tag: alpine | |
suffix: "-alpine" | |
is_default: false | |
platforms: linux/amd64,linux/arm64 | |
runs-on: ubuntu-latest | |
steps: | |
# docker push action, see https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: ${{ secrets.DOCKERHUB_REPONAME }}/${{ github.event.repository.name }} | |
flavor: latest=${{ matrix.is_default }} | |
tags: | | |
type=raw,value=latest${{ matrix.suffix }},enable=true | |
type=raw,value=sha-${{ github.sha }}${{ matrix.suffix }},enable=true | |
type=raw,value='{{version}}'${{ matrix.suffix }},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
type=raw,value='{{major}}.{{minor}}'${{ matrix.suffix }},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
type=raw,value='{{major}}'${{ matrix.suffix }},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile${{ matrix.tag != '' && format('.{0}', matrix.tag) || '' }} | |
push: true | |
platforms: ${{ matrix.platforms }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
provenance: false | |