v1.27.1-1 #1
Workflow file for this run
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 Release | |
on: | |
release: | |
types: [published] | |
permissions: | |
# Required by sigstore | |
id-token: write | |
jobs: | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set REPOSITORY | |
shell: bash | |
run: echo "REPOSITORY=${GITHUB_REPOSITORY#*/}" >> "${GITHUB_ENV}" | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 | |
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 | |
- uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0 | |
id: meta | |
with: | |
images: ${{ github.repository_owner }}/${{ env.REPOSITORY }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=match,pattern=v(\d+\.\d+\.\d+\-\d+),group=1 | |
type=match,pattern=v(\d+\.\d+\.\d+),group=1 | |
type=match,pattern=v(\d+\.\d+),group=1 | |
type=match,pattern=v(\d+),group=1 | |
type=sha | |
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 | |
id: build | |
with: | |
context: ${{ env.REPOSITORY }} | |
platforms: linux/amd64,linux/arm64 | |
pull: true | |
push: true | |
sbom: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Install cosign | |
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1 | |
- name: Sign the Docker image | |
working-directory: ${{ env.REPOSITORY }} | |
env: | |
DIGEST: ${{ steps.build.outputs.digest }} | |
TAGS: ${{ steps.meta.outputs.tags }} | |
shell: bash | |
run: | | |
images="" | |
for tag in ${TAGS}; do | |
images+="${tag}@${DIGEST} " | |
done | |
# shellcheck disable=SC2086 | |
cosign sign --recursive --yes ${images} |