ci: more docker tags
This commit is contained in:
parent
00a1ed912b
commit
b52e18aca1
1 changed files with 5 additions and 15 deletions
20
.github/workflows/docker.yml
vendored
20
.github/workflows/docker.yml
vendored
|
@ -25,16 +25,6 @@ jobs:
|
||||||
ref: "main"
|
ref: "main"
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Release tag
|
|
||||||
id: releasetag
|
|
||||||
run: |
|
|
||||||
if [ -z "${{ inputs.tag }}" ]; then
|
|
||||||
latest_release_tag=$(curl -s "https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/latest" | jq -r .tag_name)
|
|
||||||
echo "release_tag=${latest_release_tag}" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "release_tag=${{ inputs.tag }}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
@ -42,9 +32,11 @@ jobs:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
|
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable=true
|
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
|
||||||
type=sha
|
type=sha
|
||||||
type=raw,value=${{ steps.releasetag.outputs.release_tag }},enable=true
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=raw,value=${{ inputs.tags }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
@ -58,7 +50,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
@ -66,13 +57,12 @@ jobs:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GH_TOKEN }}
|
password: ${{ secrets.GH_TOKEN }}
|
||||||
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
|
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: ./
|
context: ./
|
||||||
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
|
push: ${{ !github.event.pull_request.head.repo.fork }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
Loading…
Reference in a new issue