Skip to content

Commit 9d7bab9

Browse files
committed
ci: support releasing on pvtnbr
1 parent 4572917 commit 9d7bab9

File tree

2 files changed

+52
-27
lines changed

2 files changed

+52
-27
lines changed

.github/workflows/release.yml

+51-25
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,61 @@ name: Release
22

33
on:
44
push:
5-
branches: [master, next]
5+
branches: [master, develop]
6+
7+
permissions:
8+
contents: write
69

710
jobs:
811
release:
912
name: Release
13+
if: (
14+
github.repository_owner == 'pvtnbr' && github.ref_name =='develop'
15+
) || (
16+
github.repository_owner == 'privatenumber' && github.ref_name =='master'
17+
)
1018
runs-on: ubuntu-latest
1119
timeout-minutes: 10
20+
1221
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
16-
- name: Use Node.js
17-
uses: actions/setup-node@v4
18-
with:
19-
node-version-file: '.nvmrc'
20-
21-
- name: Setup pnpm
22-
uses: pnpm/action-setup@v4
23-
with:
24-
run_install: true
25-
26-
- name: Build
27-
run: pnpm build
28-
29-
- name: Test
30-
run: pnpm test
31-
32-
- name: Release
33-
env:
34-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
35-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36-
run: pnpm dlx semantic-release
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
token: ${{ secrets.GH_TOKEN }}
26+
27+
- name: Use Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version-file: .nvmrc
31+
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v3
34+
with:
35+
run_install: true
36+
37+
- name: Lint
38+
run: pnpm lint
39+
40+
- name: Prerelease to GitHub
41+
if: github.repository_owner == 'pvtnbr'
42+
run: |
43+
git remote add public https://github.com/$(echo $GITHUB_REPOSITORY | sed "s/^pvtnbr/privatenumber/")
44+
git fetch public master 'refs/tags/*:refs/tags/*'
45+
git push --force --tags origin refs/remotes/public/master:refs/heads/master
46+
47+
jq '
48+
.publishConfig.registry = "https://npm.pkg.github.com"
49+
| .name = ("@" + env.GITHUB_REPOSITORY_OWNER + "/" + .name)
50+
| .repository = env.GITHUB_REPOSITORY
51+
| .release.branches = [
52+
"master",
53+
{ name: "develop", prerelease: "rc", channel: "latest" }
54+
]
55+
' package.json > _package.json
56+
mv _package.json package.json
57+
58+
- name: Release
59+
env:
60+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
61+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
62+
run: pnpm dlx semantic-release

.github/workflows/test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Test
22
on:
33
push:
4-
branches: [develop]
4+
branches: [master, develop]
55
pull_request:
6-
branches: [master, develop, next]
76
jobs:
87
test:
98
name: Test

0 commit comments

Comments
 (0)