Skip to content

refactor, chore(deps): support rust 2024 edition, update deps #339

refactor, chore(deps): support rust 2024 edition, update deps

refactor, chore(deps): support rust 2024 edition, update deps #339

Workflow file for this run

name: Publish Docker image
on:
workflow_dispatch:
push:
branches: ['master']
tags: '[0-9]+\.[0-9]+\.[0-9]+*'
paths-ignore:
- '.gitignore'
- '.env.dist'
- '.github/dependabot.yml'
- '.github/workflows/release.yml'
- 'LICENSE'
- 'README.md'
#pull_request:
#pull_request_target:
# branches: ['master']
# paths-ignore:
# - '.gitignore'
# - '.env.dist'
# - '.github/dependabot.yml'
# - '.github/workflows/release.yml'
# - 'LICENSE'
# - 'README.md'
env:
GHCR_REPO: ghcr.io/konradhoeffner/rickview
jobs:
build:
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
# config:
# - {arch: 'arm64'}
# - {arch: 'amd64'}
# runs-on: ${{ matrix.config.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
runs-on: ${{ matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
permissions:
contents: read
packages: write
steps:
# checkout action does not seem to be needed
#- name: Checkout repository
# uses: actions/checkout@v4
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REPO }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
#tags: |
# ${{ steps.meta.outputs.tags }}
# ghcr.io/konradhoeffner/rickview:latest-${{matrix.config.arch}}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
#outputs: type=image,"name=${{ env.DOCKERHUB_REPO }},${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
#cache-from: type=registry,ref=ghcr.io/konradhoeffner/rickview:master-${{matrix.config.arch}}
#cache-to: type=inline
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-24.04-arm
needs: build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REPO }}
#type=ref,event=pr
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *)
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
- name: Inspect image
# docker buildx imagetools inspect ${{ env.DOCKERHUB_REPO }}:${{ steps.meta.outputs.version }}
run: |
docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }}
# - name: Create and push manifest images
# uses: Noelware/docker-manifest-action@master
# with:
# inputs: ghcr.io/konradhoeffner/rickview:latest,ghcr.io/konradhoeffner/rickview:master
# images: ghcr.io/konradhoeffner/rickview:latest-amd64,ghcr.io/konradhoeffner/rickview:latest-arm64
# push: true