Publish rechunk to GHCR #62
This file contains hidden or 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: Publish rechunk to GHCR | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'The version to tag the package with:' | |
required: true | |
x86: | |
description: 'Build only for x86_64' | |
type: boolean | |
default: false | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
deploy_ghcr: | |
permissions: | |
# contents: write | |
packages: write | |
environment: prod | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: ${{ github.event.inputs.x86 == 'true' && fromJSON('["x86_64"]') || fromJSON('["aarch64", "x86_64"]') }} | |
fedora_version: [41] | |
runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-24.04' }} | |
steps: | |
- name: Login to GHCR | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | sudo podman login ghcr.io -u ${{ github.actor }} --password-stdin | |
- uses: actions/checkout@v3 | |
- name: Build Image | |
run: | | |
sudo podman build --tag 'fedora_build' . | |
- name: Upload Image | |
id: upload | |
shell: bash | |
run: | | |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then | |
VERSION="${{ github.event.inputs.tag }}" | |
elif [[ -n "${{ github.event.release.tag_name }}" ]]; then | |
VERSION="${{ github.event.release.tag_name }}" | |
else | |
echo "No version tag provided" | |
exit 1 | |
fi | |
sudo podman tag fedora_build ghcr.io/hhd-dev/rechunk:$VERSION-${{ matrix.arch }} | |
sudo podman push ghcr.io/hhd-dev/rechunk:$VERSION-${{ matrix.arch }} | |
deploy_combined_ghcr: | |
runs-on: ubuntu-24.04 | |
needs: [deploy_ghcr] | |
permissions: | |
packages: write | |
steps: | |
- name: Login to GHCR | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | sudo podman login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push Manifest | |
run: | | |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then | |
VERSION="${{ github.event.inputs.tag }}" | |
elif [[ -n "${{ github.event.release.tag_name }}" ]]; then | |
VERSION="${{ github.event.release.tag_name }}" | |
else | |
echo "No version tag provided" | |
exit 1 | |
fi | |
sudo podman manifest create rechunk | |
SHA=$(skopeo inspect ghcr.io/hhd-dev/rechunk:$VERSION-x86_64 | jq ".Digest") | |
sudo podman manifest add rechunk ghcr.io/hhd-dev/rechunk@$SHA --arch linux/amd64 | |
if [[ ${{ github.event.inputs.x86 }} != "true" ]]; then | |
SHA=$(skopeo inspect ghcr.io/hhd-dev/rechunk:$VERSION-aarch64 | jq ".Digest") | |
sudo podman manifest add rechunk ghcr.io/hhd-dev/rechunk@$SHA --arch linux/arm64 | |
fi | |
sudo podman manifest push --all=false rechunk ghcr.io/hhd-dev/rechunk:latest | |
sudo podman manifest push --all=false rechunk ghcr.io/hhd-dev/rechunk:stable | |
sudo podman manifest push --all=false rechunk ghcr.io/hhd-dev/rechunk:$VERSION |