mirror of
https://github.com/3proxy/3proxy.git
synced 2026-08-26 09:55:48 +08:00
Rework docker workflow, add build provenance attestations
Docker: single workflow, one job per image per platform instead of one workflow per registry. Platforms are built in parallel and pushed by digest, then combined into a manifest list pushed to Docker Hub and GHCR at once, so both registries get identical digests. arm64 and arm/v7 build on native arm runners, ppc64le is dropped. Registry provenance/sbom attestations are disabled (they were shown as unknown/unknown entries in the registries), build provenance is attested with actions/attest-build-provenance instead and is verifiable with 'gh attestation verify oci://...'. Release binaries (rpm, deb, zip) are attested the same way. cosign version is pinned and images are signed by digest.
This commit is contained in:
parent
8e2732b323
commit
3dfd9052be
9
.github/workflows/build-rpm-arm64.yml
vendored
9
.github/workflows/build-rpm-arm64.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -81,3 +83,10 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm64.deb
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm64.deb
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.rpm
|
||||||
|
*.deb
|
||||||
|
|||||||
9
.github/workflows/build-rpm-armhf.yml
vendored
9
.github/workflows/build-rpm-armhf.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -114,3 +116,10 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm.deb
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm.deb
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.rpm
|
||||||
|
*.deb
|
||||||
|
|||||||
9
.github/workflows/build-rpm-x86-64.yml
vendored
9
.github/workflows/build-rpm-x86-64.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -82,3 +84,10 @@ jobs:
|
|||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.x86_64.deb
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.x86_64.deb
|
||||||
|
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.rpm
|
||||||
|
*.deb
|
||||||
|
|||||||
8
.github/workflows/build-watcom.yml
vendored
8
.github/workflows/build-watcom.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -93,3 +95,9 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-lite.zip
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-lite.zip
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
|
|||||||
8
.github/workflows/build-win32.yml
vendored
8
.github/workflows/build-win32.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -108,3 +110,9 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x86.zip
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x86.zip
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
|
|||||||
8
.github/workflows/build-win64.yml
vendored
8
.github/workflows/build-win64.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -109,3 +111,9 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x64.zip
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x64.zip
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
|
|||||||
8
.github/workflows/build-winarm64.yml
vendored
8
.github/workflows/build-winarm64.yml
vendored
@ -7,6 +7,8 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@ -108,3 +110,9 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-arm64.zip
|
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-arm64.zip
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
|
|||||||
99
.github/workflows/docker-ghcr.yml
vendored
99
.github/workflows/docker-ghcr.yml
vendored
@ -1,99 +0,0 @@
|
|||||||
name: Build Docker images (GHCR)
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and push Docker images
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v7
|
|
||||||
|
|
||||||
- name: Determine tags
|
|
||||||
id: tags
|
|
||||||
env:
|
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
||||||
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
run: |
|
|
||||||
if [[ "$RELEASE_TAG" != "" ]]; then
|
|
||||||
RELEASE="${RELEASE_TAG#v}"
|
|
||||||
echo "minimal=${IMAGE}:${RELEASE}.minimal,${IMAGE}:lts-minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${IMAGE}:${RELEASE}.busybox,${IMAGE}:lts-busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${IMAGE}:${RELEASE},${IMAGE}:lts" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
DATETIME=$(date +%d%m%y%H%M%S)
|
|
||||||
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
|
|
||||||
echo "minimal=${IMAGE}:${DATETIME}-${BRANCH}.minimal,${IMAGE}:${BRANCH}.minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${IMAGE}:${DATETIME}-${BRANCH}.busybox,${IMAGE}:${BRANCH}.busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${IMAGE}:${DATETIME}-${BRANCH},${IMAGE}:${BRANCH}" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
|
|
||||||
- name: Install cosign
|
|
||||||
uses: sigstore/cosign-installer@v3
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push minimal
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.minimal
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.minimal }}
|
|
||||||
|
|
||||||
- name: Build and push busybox
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.busybox
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.busybox }}
|
|
||||||
|
|
||||||
- name: Build and push full
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.full
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.full }}
|
|
||||||
|
|
||||||
- name: Sign images
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
env:
|
|
||||||
TAGS_MINIMAL: ${{ steps.tags.outputs.minimal }}
|
|
||||||
TAGS_BUSYBOX: ${{ steps.tags.outputs.busybox }}
|
|
||||||
TAGS_FULL: ${{ steps.tags.outputs.full }}
|
|
||||||
run: |
|
|
||||||
IFS=',' read -ra TAGS <<< "$TAGS_MINIMAL,$TAGS_BUSYBOX,$TAGS_FULL"
|
|
||||||
for tag in "${TAGS[@]}"; do
|
|
||||||
cosign sign --yes "$tag"
|
|
||||||
done
|
|
||||||
|
|
||||||
199
.github/workflows/docker.yml
vendored
199
.github/workflows/docker.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Build Docker images (Docker Hub)
|
name: Build Docker images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@ -7,89 +7,182 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
packages: write
|
||||||
id-token: write
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.io
|
DOCKERHUB_IMAGE: docker.io/3proxy/3proxy
|
||||||
IMAGE_NAME: 3proxy/3proxy
|
GHCR_IMAGE: ghcr.io/3proxy/3proxy
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build and push Docker images
|
name: ${{ matrix.image }} ${{ matrix.platform }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.runner }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
image: [full, busybox, minimal]
|
||||||
|
platform: [linux/amd64, linux/arm64, linux/arm/v7]
|
||||||
|
include:
|
||||||
|
- platform: linux/amd64
|
||||||
|
runner: ubuntu-latest
|
||||||
|
- platform: linux/arm64
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
|
- platform: linux/arm/v7
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Determine tags
|
- name: Platform name
|
||||||
id: tags
|
id: platform
|
||||||
env:
|
run: echo "pair=$(echo '${{ matrix.platform }}' | tr / -)" >> "$GITHUB_OUTPUT"
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
||||||
run: |
|
|
||||||
if [[ "$RELEASE_TAG" != "" ]]; then
|
|
||||||
RELEASE="${RELEASE_TAG#v}"
|
|
||||||
echo "minimal=${REGISTRY}/${IMAGE_NAME}:${RELEASE}.minimal,${REGISTRY}/${IMAGE_NAME}:lts-minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${REGISTRY}/${IMAGE_NAME}:${RELEASE}.busybox,${REGISTRY}/${IMAGE_NAME}:lts-busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${REGISTRY}/${IMAGE_NAME}:${RELEASE},${REGISTRY}/${IMAGE_NAME}:lts" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
DATETIME=$(date +%d%m%y%H%M%S)
|
|
||||||
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
|
|
||||||
echo "minimal=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH}.minimal,${REGISTRY}/${IMAGE_NAME}:${BRANCH}.minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH}.busybox,${REGISTRY}/${IMAGE_NAME}:${BRANCH}.busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH},${REGISTRY}/${IMAGE_NAME}:${BRANCH}" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
|
if: matrix.platform == 'linux/arm/v7'
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push by digest
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile.${{ matrix.image }}
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
provenance: false
|
||||||
|
sbom: false
|
||||||
|
outputs: type=image,name=${{ env.GHCR_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
|
- name: Export digest
|
||||||
|
env:
|
||||||
|
DIGEST: ${{ steps.build.outputs.digest }}
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
touch "/tmp/digests/${DIGEST#sha256:}"
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: digests-${{ matrix.image }}-${{ steps.platform.outputs.pair }}
|
||||||
|
path: /tmp/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Publish ${{ matrix.image }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- image: full
|
||||||
|
suffix: ''
|
||||||
|
floating: lts
|
||||||
|
- image: busybox
|
||||||
|
suffix: .busybox
|
||||||
|
floating: lts-busybox
|
||||||
|
- image: minimal
|
||||||
|
suffix: .minimal
|
||||||
|
floating: lts-minimal
|
||||||
|
steps:
|
||||||
|
- name: Download digests
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
path: /tmp/digests
|
||||||
|
pattern: digests-${{ matrix.image }}-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
uses: sigstore/cosign-installer@v3
|
uses: sigstore/cosign-installer@v3
|
||||||
|
with:
|
||||||
|
cosign-release: v2.4.3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v4
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push minimal
|
- name: Login to GHCR
|
||||||
uses: docker/build-push-action@v7
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
registry: ghcr.io
|
||||||
file: Dockerfile.minimal
|
username: ${{ github.actor }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.minimal }}
|
|
||||||
|
|
||||||
- name: Build and push busybox
|
- name: Determine tags
|
||||||
uses: docker/build-push-action@v7
|
id: tags
|
||||||
with:
|
env:
|
||||||
context: .
|
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||||
file: Dockerfile.busybox
|
SUFFIX: ${{ matrix.suffix }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
FLOATING: ${{ matrix.floating }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
run: |
|
||||||
tags: ${{ steps.tags.outputs.busybox }}
|
if [[ "$RELEASE_TAG" != "" ]]; then
|
||||||
|
RELEASE="${RELEASE_TAG#v}"
|
||||||
|
echo "versioned=${RELEASE}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "moving=${FLOATING}" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
DATETIME=$(date +%d%m%y%H%M%S)
|
||||||
|
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
|
||||||
|
echo "versioned=${DATETIME}-${BRANCH}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "moving=${BRANCH}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build and push full
|
- name: Create manifest list and push
|
||||||
uses: docker/build-push-action@v7
|
working-directory: /tmp/digests
|
||||||
|
env:
|
||||||
|
VERSIONED: ${{ steps.tags.outputs.versioned }}
|
||||||
|
MOVING: ${{ steps.tags.outputs.moving }}
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create \
|
||||||
|
-t "${DOCKERHUB_IMAGE}:${VERSIONED}" \
|
||||||
|
-t "${DOCKERHUB_IMAGE}:${MOVING}" \
|
||||||
|
-t "${GHCR_IMAGE}:${VERSIONED}" \
|
||||||
|
-t "${GHCR_IMAGE}:${MOVING}" \
|
||||||
|
$(printf "${GHCR_IMAGE}@sha256:%s " *)
|
||||||
|
|
||||||
|
- name: Get pushed digest
|
||||||
|
id: digest
|
||||||
|
env:
|
||||||
|
VERSIONED: ${{ steps.tags.outputs.versioned }}
|
||||||
|
run: |
|
||||||
|
DIGEST=$(docker buildx imagetools inspect "${DOCKERHUB_IMAGE}:${VERSIONED}" \
|
||||||
|
--format '{{json .Manifest}}' | jq -r .digest)
|
||||||
|
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Attest Docker Hub image
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
subject-name: ${{ env.DOCKERHUB_IMAGE }}
|
||||||
file: Dockerfile.full
|
subject-digest: ${{ steps.digest.outputs.digest }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
push-to-registry: false
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.full }}
|
- name: Attest GHCR image
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-name: ${{ env.GHCR_IMAGE }}
|
||||||
|
subject-digest: ${{ steps.digest.outputs.digest }}
|
||||||
|
push-to-registry: false
|
||||||
|
|
||||||
- name: Sign images
|
- name: Sign images
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
env:
|
env:
|
||||||
TAGS_MINIMAL: ${{ steps.tags.outputs.minimal }}
|
DIGEST: ${{ steps.digest.outputs.digest }}
|
||||||
TAGS_BUSYBOX: ${{ steps.tags.outputs.busybox }}
|
|
||||||
TAGS_FULL: ${{ steps.tags.outputs.full }}
|
|
||||||
run: |
|
run: |
|
||||||
IFS=',' read -ra TAGS <<< "$TAGS_MINIMAL,$TAGS_BUSYBOX,$TAGS_FULL"
|
cosign sign --yes "${DOCKERHUB_IMAGE}@${DIGEST}"
|
||||||
for tag in "${TAGS[@]}"; do
|
cosign sign --yes "${GHCR_IMAGE}@${DIGEST}"
|
||||||
cosign sign --yes "$tag"
|
|
||||||
done
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user