Files
yutu/.github/actions/github-packages/action.yml
T

48 lines
1.4 KiB
YAML

name: Release to GitHub Packages
description: Release to GitHub Packages
inputs:
version:
description: 'The version of the package'
required: true
runs:
using: composite
steps:
- uses: actions/checkout@v4
- id: ldflags
shell: bash
run: |
echo "commit-date=$(git log -1 --date='format:%Y-%m-%d/%H.%M.%S' --pretty=%cd)" >> "$GITHUB_OUTPUT"
echo "commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- id: push
uses: docker/build-push-action@v5
with:
context: .
target: yutu
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
provenance: true
build-args: |
version=${{ inputs.version }}
commit=${{ steps.ldflags.outputs.commit }}
commitDate=${{ steps.ldflags.outputs.commit-date }}
- uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true