Skip to content

Commit 31a32a4

Browse files
authored
ci: fire Android + npm publishes on the unified v* tag too (#185)
A single v<X.Y.Z> tag now releases crates.io + PyPI + Maven Central + npm + SwiftPM at one version.
1 parent c302a1d commit 31a32a4

3 files changed

Lines changed: 37 additions & 12 deletions

File tree

.github/workflows/android-aar.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Build and Publish Android AAR
33
on:
44
push:
55
tags:
6-
- "android-v*" # e.g. android-v0.5.0 → publishes 0.5.0
6+
- "v*" # unified release tag, e.g. v0.5.3 → publishes 0.5.3
7+
- "android-v*" # android-only release, e.g. android-v0.5.3
78
workflow_dispatch:
89
inputs:
910
version:
@@ -40,6 +41,8 @@ jobs:
4041
VERSION="${{ github.event.inputs.version }}"
4142
elif [[ "$GITHUB_REF" == refs/tags/android-v* ]]; then
4243
VERSION="${GITHUB_REF#refs/tags/android-v}"
44+
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
45+
VERSION="${GITHUB_REF#refs/tags/v}"
4346
else
4447
VERSION="$(grep -E '^version\s*=' dcap-qvl-mobile/Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
4548
fi
@@ -103,7 +106,7 @@ jobs:
103106
# (No signing passphrase — the release key is unprotected.)
104107
- name: Publish to Maven Central
105108
if: |
106-
startsWith(github.ref, 'refs/tags/android-v')
109+
startsWith(github.ref, 'refs/tags/')
107110
|| github.event.inputs.publish_target == 'sonatype'
108111
working-directory: dcap-qvl-mobile/android
109112
env:

.github/workflows/publish-npm.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Publish npm Package
33
on:
44
push:
55
tags:
6-
- "npm-v*" # Trigger on tags like npm-v0.0.1
6+
- "v*" # unified release tag, e.g. v0.5.3
7+
- "npm-v*" # npm-only release, e.g. npm-v0.0.1
78
workflow_dispatch:
89
inputs:
910
version:
@@ -37,12 +38,21 @@ jobs:
3738
id: npm-meta
3839
run: |
3940
if [[ "${{ github.event_name }}" == "push" ]]; then
40-
# Tag push: npm-v0.1.0 -> version=0.1.0, npm_tag=latest
4141
NPM_TAG="latest"
42-
VERSION=${GITHUB_REF#refs/tags/npm-v}
43-
UPDATE_VERSION="true" # Update package.json to match tag
44-
COMMIT_VERSION="true" # Commit back to keep repository in sync
45-
echo "Triggered by tag push: npm-v$VERSION"
42+
if [[ "$GITHUB_REF" == refs/tags/npm-v* ]]; then
43+
# npm-only tag: npm-v0.1.0 -> 0.1.0; patch package.json + commit back.
44+
VERSION=${GITHUB_REF#refs/tags/npm-v}
45+
UPDATE_VERSION="true"
46+
COMMIT_VERSION="true"
47+
echo "Triggered by npm-only tag push: npm-v$VERSION"
48+
else
49+
# Unified tag: v0.5.3 -> 0.5.3. package.json was already bumped in
50+
# the release commit, so don't commit back from a tag build.
51+
VERSION=${GITHUB_REF#refs/tags/v}
52+
UPDATE_VERSION="true"
53+
COMMIT_VERSION="false"
54+
echo "Triggered by unified tag push: v$VERSION"
55+
fi
4656
else
4757
# Manual dispatch
4858
NPM_TAG="${{ github.event.inputs.npm_tag || 'beta' }}"

dcap-qvl-mobile/RELEASING.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,19 @@ the satellite repo.
5050

5151
## Unified versioning
5252

53-
`crates.io`, `npm`, Maven Central, and SwiftPM all share one `X.Y.Z`. The iOS
54-
pipeline keys on the bare `v<X.Y.Z>` tag; Android keeps its `android-v*` trigger
55-
for now. Consolidating every ecosystem onto a single `v*` tag is a follow-up —
56-
it only needs the existing per-ecosystem workflows' triggers pointed at `v*`.
53+
A single **`v<X.Y.Z>`** tag releases every ecosystem at the same version:
54+
55+
| Workflow | Publishes |
56+
| --- | --- |
57+
| `release.yml` | `dcap-qvl` + `dcap-qvl-cli` → crates.io, CLI binaries, GitHub Release |
58+
| `python-wheels.yml` | `dcap-qvl` wheels → PyPI |
59+
| `android-aar.yml` | `com.phala:dcap-qvl-android` → Maven Central |
60+
| `publish-npm.yml` | `@phala/dcap-qvl` → npm |
61+
| `ios-release.yml` | Swift package → `dcap-qvl-swift` |
62+
63+
Bump every manifest to the new version first (root `Cargo.toml`,
64+
`cli/Cargo.toml` + its `dcap-qvl` dep, `dcap-qvl-js/package.json`,
65+
`dcap-qvl-mobile/Cargo.toml`), commit, then push the `v<X.Y.Z>` tag.
66+
67+
The per-ecosystem prefixes (`android-v*`, `npm-v*`) still work for releasing a
68+
single ecosystem out of band, but the normal path is one `v*` tag for all.

0 commit comments

Comments
 (0)