Skip to content

🔥 Removed dependabot #145

🔥 Removed dependabot

🔥 Removed dependabot #145

Workflow file for this run

name: Publish containers to GHCR
on:
push:
branches: edge
env:
REGISTRY_IMAGE: ghcr.io/thijmengthn/swaparr
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- docker: linux/amd64
cross: x86_64-unknown-linux-musl
- docker: linux/arm/v7
cross: aarch64-unknown-linux-musl
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build binary with cross
run: |
export CROSS_NO_WARNINGS=0
curl https://sh.rustup.rs -sSf | sh -s -- -y
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target ${{ matrix.platform.cross }}
mv target/${{ matrix.platform.cross }}/release/swaparr .
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: thijmengthn
password: ${{ secrets.GH_PAT }}
- name: Set Metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Build container and push by digest
uses: docker/build-push-action@v6
id: push
with:
context: .
platforms: ${{ matrix.platform.docker }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.push.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Store Platform Pair
run: |
platform=${{ matrix.platform.docker }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Merge
runs-on: ubuntu-latest
needs: build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Set Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=edge
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: thijmengthn
password: ${{ secrets.GH_PAT }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) \
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
clean:
name: Clean
needs: merge
if: always()
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: Chizkiyahu/delete-untagged-ghcr-action@v3
with:
token: ${{ secrets.GH_PAT }}
repository: ${{ github.repository }}
repository_owner: ${{ github.repository_owner }}
package_name: 'swaparr'
untagged_only: true
except_untagged_multiplatform: true
owner_type: 'user'