change linkify to fork (#258) #373
This file contains 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: docker | |
on: | |
push: | |
branches: | |
- 'pl.kpherox.dev' | |
pull_request: | |
env: | |
REGISTRY_IMAGE: ghcr.io/${{ github.repository }} | |
ELIXIR_VER: '1.14.5' | |
ERLANG_VER: '26.2.4' | |
ALPINE_VER: '3.19.1' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
platform: amd64 | |
- os: ubuntu-aarch64 | |
platform: arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
annotations: "org.opencontainers.image.licenses=AGPL-3.0-only" | |
labels: "org.opencontainers.image.licenses=AGPL-3.0-only" | |
- run: rm -rf package.json package-lock.json node_modules | |
#- name: Set up QEMU | |
# if: matrix.platform == 'arm64' | |
# uses: docker/setup-qemu-action@v3 | |
#- name: Setup erl flags for QEMU | |
# if: matrix.platform == 'arm64' | |
# run: | | |
# echo "ERL_FLAGS=+JPperf true" >> "$GITHUB_ENV" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push by digest | |
id: build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/${{ matrix.platform }} | |
build-args: | | |
ERL_FLAGS=${{ env.ERL_FLAGS }} | |
ELIXIR_VER=${{ env.ELIXIR_VER }} | |
ERLANG_VER=${{ env.ERLANG_VER }} | |
ALPINE_VER=${{ env.ALPINE_VER }} | |
annotations: ${{ steps.metadata.outputs.annotations }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
provenance: false | |
outputs: type=image,oci-mediatypes=true,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
- run: echo "${{ steps.build.outputs.digest }}" > digest-${{ matrix.platform }}.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: digest-${{ matrix.platform }} | |
path: digest-${{ matrix.platform }}.txt | |
merge: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
packages: write | |
id-token: write | |
needs: | |
- build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: digests | |
pattern: digest-* | |
merge-multiple: true | |
- name: Get digests | |
id: digests | |
run: | | |
{ | |
echo 'result<<EOF' | |
find digests -name 'digest-*.txt' -exec cat {} \; | |
echo 'EOF' | |
} >> "$GITHUB_OUTPUT" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Docker metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
env: | |
DOCKER_METADATA_ANNOTATIONS_LEVELS: index | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
annotations: "org.opencontainers.image.licenses=AGPL-3.0-only" | |
tags: | | |
type=ref,event=pr | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=sha,prefix= | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest list and push | |
uses: kphrx/[email protected] | |
with: | |
annotations: ${{ steps.metadata.outputs.annotations }} | |
sources: ${{ steps.digests.outputs.result }} | |
tags: ${{ steps.metadata.outputs.tags }} |