Skip to content

atomic-build-and-publish #429

atomic-build-and-publish

atomic-build-and-publish #429

Workflow file for this run

---
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
- kinoite
- 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@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # 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@e5153f5610d82ac9f3f848f3a25ad9d696641068 # 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@e5153f5610d82ac9f3f848f3a25ad9d696641068 # 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