Skip to content

control rook image via chart (#17) #18

control rook image via chart (#17)

control rook image via chart (#17) #18

Workflow file for this run

name: Release
on:
push:
branches: [main]
tags: ["v*"]
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/${{ github.repository }}
ROOK_IMAGE: ghcr.io/${{ github.repository }}-rook
jobs:
build:
name: Build (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
permissions:
packages: write
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: deploy/Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digest-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
build-rook:
name: Build rook (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
permissions:
packages: write
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: deploy/rook.Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.ROOK_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/rook-digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/rook-digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: rook-digest-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: /tmp/rook-digests/*
if-no-files-found: error
retention-days: 1
merge-rook:
name: Merge and push rook manifest
needs: build-rook
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/rook-digests
pattern: rook-digest-*
merge-multiple: true
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.ROOK_IMAGE }}
tags: |
type=sha,prefix=,format=short,enable=${{ github.ref_type == 'branch' }}
type=raw,value=nightly,enable=${{ github.ref_type == 'branch' }}
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
- name: Create and push manifest
working-directory: /tmp/rook-digests
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.ROOK_IMAGE }}@sha256:%s ' *)
merge:
name: Merge and push manifest
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digest-*
merge-multiple: true
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=sha,prefix=,format=short,enable=${{ github.ref_type == 'branch' }}
type=raw,value=nightly,enable=${{ github.ref_type == 'branch' }}
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
- name: Create and push manifest
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
- name: Create GitHub release
if: github.ref_type == 'tag'
uses: metalbear-co/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
with:
generate_release_notes: true