π Removed build for windows specifically #151
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 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: | |
# Standard x86_64 Linux servers and desktops | |
- docker: linux/amd64 | |
cross: x86_64-unknown-linux-musl | |
# 32-bit ARM devices | |
- docker: linux/arm/v6 | |
cross: arm-unknown-linux-musleabi | |
# 32-bit ARMv7 devices | |
- docker: linux/arm/v7 | |
cross: armv7-unknown-linux-musleabihf | |
# 64-bit ARM devices | |
- docker: linux/arm64 | |
cross: aarch64-unknown-linux-musl | |
# IBM PowerPC 64-bit | |
- docker: linux/ppc64le | |
cross: powerpc64le-unknown-linux-gnu | |
# IBM Z | |
- docker: linux/s390x | |
cross: s390x-unknown-linux-gnu | |
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' |