@@ -2,35 +2,61 @@ name: Release
2
2
3
3
on :
4
4
push :
5
- branches : [master, next]
5
+ branches : [master, develop]
6
+
7
+ permissions :
8
+ contents : write
6
9
7
10
jobs :
8
11
release :
9
12
name : Release
13
+ if : (
14
+ github.repository_owner == 'pvtnbr' && github.ref_name =='develop'
15
+ ) || (
16
+ github.repository_owner == 'privatenumber' && github.ref_name =='master'
17
+ )
10
18
runs-on : ubuntu-latest
11
19
timeout-minutes : 10
20
+
12
21
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
0 commit comments