160 lines
5.7 KiB
YAML
160 lines
5.7 KiB
YAML
name: Build docker images and nothing else
|
|
concurrency:
|
|
group: "release-image-${{ github.ref }}"
|
|
|
|
on:
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
BUILTIN_REGISTRY: forgejo.ellis.link
|
|
BUILTIN_REGISTRY_ENABLED: false
|
|
IMAGE_PATH: forgejo.ellis.link/continuwuation/continuwuity
|
|
|
|
jobs:
|
|
build-release:
|
|
name: "Build ${{ matrix.slug }} (release)"
|
|
runs-on: dind
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
attestations: write
|
|
id-token: write
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- platform: "linux/amd64"
|
|
slug: "linux-amd64"
|
|
- platform: "linux/arm64"
|
|
slug: "linux-arm64"
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Prepare Docker build environment
|
|
id: prepare
|
|
uses: ./.forgejo/actions/prepare-docker-build
|
|
with:
|
|
platform: ${{ matrix.platform }}
|
|
slug: ${{ matrix.slug }}
|
|
target_cpu: ""
|
|
profile: "release"
|
|
images: ${{ env.IMAGE_PATH }}
|
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
|
- name: Build and push Docker image by digest
|
|
id: build
|
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
|
|
with:
|
|
context: .
|
|
file: "docker/Dockerfile"
|
|
build-args: |
|
|
GIT_COMMIT_HASH=${{ github.sha }}
|
|
GIT_COMMIT_HASH_SHORT=${{ env.COMMIT_SHORT_SHA }}
|
|
GIT_REMOTE_URL=${{github.event.repository.html_url }}
|
|
GIT_REMOTE_COMMIT_URL=${{github.event.head_commit.url }}
|
|
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
|
|
TARGET_CPU=
|
|
RUST_PROFILE=release
|
|
CARGO_FEATURES=default
|
|
platforms: ${{ matrix.platform }}
|
|
labels: ${{ steps.prepare.outputs.metadata_labels }}
|
|
annotations: ${{ steps.prepare.outputs.metadata_annotations }}
|
|
cache-from: type=gha
|
|
# cache-to: type=gha,mode=max
|
|
sbom: true
|
|
outputs: |
|
|
${{ format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
|
|
type=local,dest=/tmp/binaries
|
|
env:
|
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
|
- name: Upload Docker artifacts
|
|
uses: ./.forgejo/actions/upload-docker-artifacts
|
|
with:
|
|
slug: ${{ matrix.slug }}
|
|
cpu_suffix: ${{ steps.prepare.outputs.cpu_suffix }}
|
|
artifact_suffix: ""
|
|
digest_suffix: ""
|
|
digest: ${{ steps.build.outputs.digest }}
|
|
|
|
merge-release:
|
|
name: "Create Multi-arch Release Manifest"
|
|
runs-on: dind
|
|
needs: build-release
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Create multi-platform manifest
|
|
uses: ./.forgejo/actions/create-docker-manifest
|
|
with:
|
|
digest_pattern: "digests-linux-{amd64,arm64}"
|
|
tag_suffix: ""
|
|
images: ${{ env.IMAGE_PATH }}
|
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
|
|
|
build-maxperf:
|
|
name: "Build ${{ matrix.slug }} (max-perf)"
|
|
runs-on: dind
|
|
needs: build-release
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- platform: "linux/amd64"
|
|
slug: "linux-amd64"
|
|
target_cpu: "haswell"
|
|
- platform: "linux/arm64"
|
|
slug: "linux-arm64"
|
|
target_cpu: ""
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Prepare max-perf Docker build environment
|
|
id: prepare
|
|
uses: ./.forgejo/actions/prepare-docker-build
|
|
with:
|
|
platform: ${{ matrix.platform }}
|
|
slug: ${{ matrix.slug }}
|
|
target_cpu: ${{ matrix.target_cpu }}
|
|
profile: "release-max-perf"
|
|
images: ${{ env.IMAGE_PATH }}
|
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
|
- name: Build max-perf Docker image by digest
|
|
id: build
|
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
|
|
with:
|
|
context: .
|
|
file: "docker/Dockerfile"
|
|
build-args: |
|
|
GIT_COMMIT_HASH=${{ github.sha }}
|
|
GIT_COMMIT_HASH_SHORT=${{ env.COMMIT_SHORT_SHA }}
|
|
GIT_REMOTE_URL=${{github.event.repository.html_url }}
|
|
GIT_REMOTE_COMMIT_URL=${{github.event.head_commit.url }}
|
|
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
|
|
TARGET_CPU=${{ matrix.target_cpu }}
|
|
RUST_PROFILE=release-max-perf
|
|
CARGO_FEATURES=default,release_max_log_level
|
|
platforms: ${{ matrix.platform }}
|
|
labels: ${{ steps.prepare.outputs.metadata_labels }}
|
|
annotations: ${{ steps.prepare.outputs.metadata_annotations }}
|
|
cache-from: type=gha
|
|
# cache-to: type=gha,mode=max
|
|
sbom: true
|
|
outputs: |
|
|
${{ format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
|
|
type=local,dest=/tmp/binaries
|
|
env:
|
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|