atomic-build-and-publish #473
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: atomic-build-and-publish | |
on: | |
schedule: | |
- cron: 30 23 * * * # 16:30 PST | |
push: | |
branches: | |
- main | |
paths: | |
- atomic/**.go | |
- atomic/go.* | |
- atomic/dagger.json | |
- .github/workflows/atomic.yaml | |
pull_request: | |
paths: | |
- atomic/**.go | |
- atomic/go.* | |
- atomic/dagger.json | |
- .github/workflows/atomic.yaml | |
# yamllint disable-line rule:empty-values | |
workflow_dispatch: | |
jobs: | |
build_push: | |
name: Atomic Fedora - Build and Publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
org: [ublue-os] | |
registry: [ghcr.io] | |
variant: | |
- silverblue | |
- niri | |
suffix: | |
- main | |
- nvidia | |
version: | |
- "40" | |
- "41" | |
env: | |
IMAGE_NAME: atomic-${{ matrix.variant }}-${{ matrix.suffix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: GitHub SHA Short | |
id: sha_short | |
run: echo "sha_short=${GITHUB_SHA::7}" >> "${GITHUB_OUTPUT}" | |
- name: Docker Image Metadata From GitHub Repository | |
# yamllint disable-line rule:line-length | |
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5 | |
id: generate_labels | |
with: | |
images: | | |
${{ env.IMAGE_NAME }} | |
- name: Dagger Build and Publish (PR) | |
# yamllint disable-line rule:line-length | |
uses: dagger/dagger-for-github@847ae4458ef34fe9b5f566655957bde6d4891112 # v7 | |
env: | |
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} | |
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | |
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY }} | |
GITHUB_TOKEN: ${{ github.token }} | |
if: | | |
github.event_name == 'pull_request' | |
&& github.ref != 'refs/heads/main' | |
with: | |
# renovate: datasource=github-releases depName=dagger/dagger | |
version: v0.14.0 | |
verb: call | |
module: atomic | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
# the labels transformation step below | |
# (xargs -I {} echo -n \"{}\", | sed 's/,*$//') | |
# changes the separator from newlines into comma | |
# yamllint disable-line rule:line-length | |
args: --source=. --registry="${{ matrix.registry }}" --org="${{ matrix.org }}" --variant="${{ matrix.variant }}" --suffix="${{ matrix.suffix }}" --tag="${{ matrix.version }}" --additional-labels="$(printf "${{ steps.generate_labels.outputs.labels }}" | xargs -I {} echo -n \"{}\", | sed 's/,*$//' )" publish-and-sign --image-registry="ghcr.io" --image-name="${{ env.IMAGE_NAME }}" --repository="containers" --username="${{ github.repository_owner }}" --secret=env:GITHUB_TOKEN --additional-tags="pr-${{ github.event.number }}-${{ matrix.version}},pr-${{ github.event.number }}-${{ matrix.version}}-${{ steps.sha_short.outputs.sha_short }}" --skip-default-tags --cosign-private-key=env:COSIGN_PRIVATE_KEY --cosign-password=env:COSIGN_PASSWORD | |
- name: Dagger Build and Publish (main) | |
# yamllint disable-line rule:line-length | |
uses: dagger/dagger-for-github@847ae4458ef34fe9b5f566655957bde6d4891112 # v7 | |
env: | |
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} | |
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | |
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY }} | |
GITHUB_TOKEN: ${{ github.token }} | |
if: | | |
github.event_name != 'pull_request' | |
&& github.ref == 'refs/heads/main' | |
with: | |
# renovate: datasource=github-releases depName=dagger/dagger | |
version: v0.14.0 | |
verb: call | |
module: atomic | |
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
# the labels transformation step below | |
# (xargs -I {} echo -n \"{}\", | sed 's/,*$//') | |
# changes the separator from newlines into comma | |
# yamllint disable-line rule:line-length | |
args: --source=. --registry="${{ matrix.registry }}" --org="${{ matrix.org }}" --variant="${{ matrix.variant }}" --suffix="${{ matrix.suffix }}" --tag="${{ matrix.version }}" --additional-labels="$(printf "${{ steps.generate_labels.outputs.labels }}" | xargs -I {} echo -n \"{}\", | sed 's/,*$//' )" publish-and-sign --image-registry="ghcr.io" --image-name="${{ env.IMAGE_NAME }}" --repository="containers" --username="${{ github.repository_owner }}" --secret=env:GITHUB_TOKEN --cosign-private-key=env:COSIGN_PRIVATE_KEY --cosign-password=env:COSIGN_PASSWORD |