Skip to content

Commit 46af9b7

Browse files
author
Sergiu Oala
committed
ci: publish release candidates
1 parent 55df133 commit 46af9b7

6 files changed

Lines changed: 71 additions & 7 deletions

File tree

‎.github/prerelease-config.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "node",
4+
"include-component-in-tag": false,
5+
"versioning": "prerelease",
6+
"prerelease": true,
7+
"prerelease-type": "rc",
8+
"packages": {
9+
".": {}
10+
}
11+
}

‎.github/prerelease-manifest.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "8.1.0"
3+
}

‎.github/release-config.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "node",
4+
"include-component-in-tag": false,
5+
"versioning": "default",
6+
"prerelease": false,
7+
"packages": {
8+
".": {
9+
"extra-files": [
10+
{
11+
"type": "json",
12+
"path": ".github/prerelease-manifest.json",
13+
"jsonpath": "$[\".\"]"
14+
}
15+
]
16+
}
17+
}
18+
}

‎.github/release-manifest.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "8.1.0"
3+
}

‎.github/workflows/npm-publish.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,11 @@ jobs:
7676
registry-url: https://registry.npmjs.org
7777

7878
- name: publish to npm
79-
run: npm publish --provenance
79+
env:
80+
RELEASE_TAG: ${{ inputs.tag }}
81+
run: |
82+
if [[ "$RELEASE_TAG" == *-rc* ]]; then
83+
npm publish --provenance --tag rc
84+
else
85+
npm publish --provenance
86+
fi

‎.github/workflows/release-please.yml‎

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,43 @@ permissions:
1111
# npm-publish is dispatched explicitly below. workflow_dispatch is one of the
1212
# few events that always creates a run, even from GITHUB_TOKEN.
1313
actions: write
14+
15+
concurrency:
16+
group: release-please
17+
cancel-in-progress: false
18+
1419
jobs:
1520
release-please:
1621
runs-on: ubuntu-latest
1722
steps:
1823
- uses: googleapis/release-please-action@v5
19-
id: release
24+
id: prerelease
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
config-file: .github/prerelease-config.json
28+
manifest-file: .github/prerelease-manifest.json
29+
target-branch: ${{ github.ref_name }}
30+
31+
# Once an RC PR is merged and tagged, replace it with the stable Release
32+
# PR. The stable config also synchronizes the prerelease manifest when
33+
# that stable PR is eventually merged.
34+
- name: create stable Release PR
35+
if: >-
36+
steps.prerelease.outputs.releases_created == 'true' &&
37+
contains(steps.prerelease.outputs.tag_name, '-rc')
38+
uses: googleapis/release-please-action@v5
2039
with:
21-
release-type: node
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
config-file: .github/release-config.json
42+
manifest-file: .github/release-manifest.json
43+
target-branch: ${{ github.ref_name }}
2244

23-
# releases_created is only true on the run that tagged a release, which is
24-
# the run triggered by merging the release PR.
45+
# The prerelease action recognizes merges of both RC and stable Release
46+
# PRs. It creates the corresponding tag and GitHub Release in either case.
2547
- name: trigger npm-publish
26-
if: steps.release.outputs.releases_created == 'true'
48+
if: steps.prerelease.outputs.releases_created == 'true'
2749
env:
2850
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2951
GH_REPO: ${{ github.repository }}
30-
TAG: ${{ steps.release.outputs.tag_name }}
52+
TAG: ${{ steps.prerelease.outputs.tag_name }}
3153
run: gh workflow run npm-publish.yml --ref "$GITHUB_REF_NAME" -f tag="$TAG"

0 commit comments

Comments
 (0)