Update package #10
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: Update package | |
on: | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
check-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.repository.default_branch }} | |
fetch-depth: 0 | |
- name: Check tag | |
run: | | |
if git tag --points-at HEAD | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | |
exit 0 | |
fi | |
echo "ERROR: There needs to be a version tag." | |
exit 1 | |
update-package: | |
runs-on: ubuntu-latest | |
needs: | |
- check-tag | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.repository.default_branch }} | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare tags | |
id: tags | |
run: | | |
echo "DIGEST=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
echo "REF_NAME=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT | |
- name: Update package | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: | | |
${{ format('ghcr.io/{0}:{1}', github.repository, steps.tags.outputs.DIGEST) }} | |
${{ format('ghcr.io/{0}:{1}', github.repository, steps.tags.outputs.REF_NAME) }} | |
${{ format('ghcr.io/{0}:{1}', github.repository, 'latest') }} |