generated from react18-tools/turborepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (68 loc) · 2.94 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Publish to NPM
# publish only when package json has changed - assuming version upgrade
on:
workflow_dispatch:
push:
branches: [main]
paths: "lib/r18gs/package.json"
jobs:
publish:
# Don't run just after creating repo from template
# Also avoid running after merging set-up PR
if: github.event.repository.owner.login == 'react18-tools'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
id-token: write
defaults:
run:
working-directory: ./lib/r18gs
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- run: npm i -g pnpm && pnpm i
name: Install dependencies
# fail and not publish if any of the unit tests are failing
- name: Test
run: pnpm test
- name: publish to NPM
run: pnpm build && pnpm publish-package
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}
- name: Create GitHub release
run: |
v=$(node -p -e "require('./package.json').version")
gh release create $v --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release $v"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish canonical packages
continue-on-error: true
run: |
sed -i -e "s/.*name.*/\t\"name\": \"@mayank1513\/r18gs\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react18-global-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react18-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react19-global-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react19-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"r19gs\",/" package.json
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Mark scoped package as deprecated
run: npm deprecate @mayank1513/r18gs "Please use https://www.npmjs.com/package/r18gs instead. We initially created scoped packages to have similarities with the GitHub Public Repository (which requires packages to be scoped). We are no longer using GPR and thus deprecating all scoped packages for which corresponding un-scoped packages exist."
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}