Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 116 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:

env:
XTL_CI: "1"
DOCKER_IMAGE: ghcr.io/xtool-org/xtool
BUILDX_VERSION: v0.39.1

jobs:
build-linux:
Expand Down Expand Up @@ -91,24 +93,120 @@ jobs:
fi
gh release create "$TAG" "${FLAGS[@]}" --title "v$TAG"
gh release upload "$TAG" output/**/*.{AppImage,AppImage.zsync,app.zip,app.dSYM.zip}
docker-build:
runs-on: ${{ matrix.host.runner }}
strategy:
fail-fast: false
matrix:
host:
- runner: ubuntu-24.04
arch: amd64
- runner: ubuntu-24.04-arm
arch: arm64
permissions:
contents: read
id-token: write
packages: write
outputs:
amd64-digest: ${{ steps.digest.outputs.amd64 }}
arm64-digest: ${{ steps.digest.outputs.arm64 }}
steps:
- name: Log in to GHCR
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
with:
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=moby/buildkit:v0.35.1@sha256:baf6138eb8c37644800c7c913fba051e840ebb9ba13eaf92d92ef9a1712d0b4c
- name: Build and push platform image by digest
id: build
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: ${{ github.server_url }}/${{ github.repository }}.git?ref=${{ github.sha }}
platforms: linux/${{ matrix.host.arch }}
build-args: XTL_CI=1
outputs: type=image,name=${{ env.DOCKER_IMAGE }},oci-artifact=true,push-by-digest=true,name-canonical=true,push=true
provenance: mode=${{ github.event.repository.private && 'min' || 'max' }},version=v1
secret-envs: GIT_AUTH_TOKEN=GIT_AUTH_TOKEN
env:
BUILDKIT_MULTI_PLATFORM: "1"
GIT_AUTH_TOKEN: ${{ github.token }}
- name: Install Docker Builder signing runtime
run: npm install --prefix "$RUNNER_TEMP" --no-save --package-lock=false --ignore-scripts --omit=dev @docker/github-builder-runtime@0.109.0
- name: Sign and verify BuildKit provenance
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
NODE_PATH: ${{ runner.temp }}/node_modules
IMAGE_DIGEST: ${{ steps.build.outputs.digest }}
with:
script: |
const { Install } = require('@docker/github-builder-runtime/lib/cosign/install');
const { Sigstore } = require('@docker/github-builder-runtime/lib/sigstore/sigstore');
const installer = new Install();
const binary = await installer.download({ version: 'v3.1.6', verifySignature: true });
await installer.install(binary);

const sigstore = new Sigstore();
const signatures = await sigstore.signAttestationManifests({
imageNames: [process.env.DOCKER_IMAGE],
imageDigest: process.env.IMAGE_DIGEST,
retryOnManifestUnknown: true,
});
if (Object.keys(signatures).length === 0) {
throw new Error('No BuildKit provenance manifest was signed');
}
const workflow = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_WORKFLOW_REF}`;
const escapedWorkflow = workflow.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
await sigstore.verifySignedManifests(signatures, {
certificateIdentityRegexp: `^${escapedWorkflow}$`,
retryOnManifestUnknown: true,
});
- name: Export verified platform digest
id: digest
env:
ARCH: ${{ matrix.host.arch }}
DIGEST: ${{ steps.build.outputs.digest }}
run: printf '%s=%s\n' "$ARCH" "$DIGEST" >> "$GITHUB_OUTPUT"

docker:
uses: docker/github-builder/.github/workflows/build.yml@v1
needs: docker-build
runs-on: ubuntu-24.04
permissions:
contents: read # to fetch the repository content
id-token: write # for signing attestations and cache entries with GitHub OIDC
packages: write # to push built images to GitHub Container Registry
with:
build-args: |
XTL_CI=1
output: image
push: true
platforms: linux/amd64,linux/arm64
meta-images: |
ghcr.io/xtool-org/xtool
meta-tags: |
type=semver,pattern={{version}}
secrets:
registry-auths: |
- registry: ghcr.io
packages: write
steps:
- name: Generate Docker tags
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.DOCKER_IMAGE }}
tags: type=semver,pattern={{version}}
- name: Log in to GHCR
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ github.token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
with:
version: ${{ env.BUILDX_VERSION }}
driver: docker
- name: Publish multi-platform Docker image
shell: bash
env:
IMAGE_TAGS: ${{ steps.meta.outputs.tags }}
AMD64_DIGEST: ${{ needs.docker-build.outputs.amd64-digest }}
ARM64_DIGEST: ${{ needs.docker-build.outputs.arm64-digest }}
run: |
: "${IMAGE_TAGS:?No Docker tags generated}" "${AMD64_DIGEST:?Missing amd64 digest}" "${ARM64_DIGEST:?Missing arm64 digest}"
mapfile -t tags <<< "$IMAGE_TAGS"
tag_args=()
for tag in "${tags[@]}"; do
tag_args+=(--tag "$tag")
done
docker buildx imagetools create "${tag_args[@]}" \
"$DOCKER_IMAGE@$AMD64_DIGEST" "$DOCKER_IMAGE@$ARM64_DIGEST"
2 changes: 1 addition & 1 deletion .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
jobs:
swiftlint:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Lint
Expand Down