-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (50 loc) · 1.69 KB
/
publish-cli-release.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
name: Publish CLI to NPM (Release)
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PACKAGE_SECRET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
scope: '@chili-publish'
- name: Check version correctness
env:
GITHUB_REF: ${{ github.ref }}
run: |
PACKAGE_VERSION=v$(npm --prefix=src/connector-cli pkg get version | tr -d '"')
TAG_VERSION=${GITHUB_REF#refs/tags/}
if [ "$PACKAGE_VERSION" = "$TAG_VERSION" ]; then
echo "The package.json version matches the tag version."
else
echo "The package.json version does not match the tag version."
echo "package.json version: $PACKAGE_VERSION"
echo "Tag version: $TAG_VERSION"
exit 1
fi
- name: Install dependencies
run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }}
- name: Build
run: yarn workspace @chili-publish/connector-cli run build
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
scope: '@chili-publish'
- name: Publish
run: yarn publish src/connector-cli --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}