-
Notifications
You must be signed in to change notification settings - Fork 10
62 lines (57 loc) · 1.69 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
name: Build and Publish
on:
release:
types: [published]
jobs:
publish:
name: Build and Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Set Package Versions
run: |
release='${{ github.event.release.tag_name }}'
version=`echo $release | cut -b2-`
if ! echo $release | grep -q '^v[0-9]\+\.[0-9]\+\.[0-9]\+$'; then
echo "Release name must be in the format of 'vX.Y.Z', got '$release'"
exit 1
fi
for pkg in packages/*; do
pushd $pkg
sed -i -r "s/\"version\": *\".+\"/\"version\": \"$version\"/" package.json
popd
done
- name: Install Dependencies
run: npm ci
- name: Build Packages
run: |
npm run clean # for paranoia
npm run build
- name: Publish to NPM
run: |
touch $HOME/.npmrc
chmod 0600 $HOME/.npmrc
cat << EOF > ~/.npmrc
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
@xeger:registry=https://registry.npmjs.org/
EOF
npm publish --workspaces
env:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
- name: Publish to GitHub
run: |
touch $HOME/.npmrc
chmod 0600 $HOME/.npmrc
cat << EOF > ~/.npmrc
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@xeger:registry=https://npm.pkg.github.com/
EOF
npm publish --workspaces
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"