-
Notifications
You must be signed in to change notification settings - Fork 16
59 lines (48 loc) · 1.57 KB
/
publish_core.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
name: Publish core
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/core
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Check version
id: check
run: |
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
echo "Version: $PACKAGE_VERSION"
HTTP_STATUS=$(curl --silent --head --write-out "%{http_code}" --output /dev/null https://registry.npmjs.org/@data-story/core/$PACKAGE_VERSION)
if [ $HTTP_STATUS -eq 200 ]; then
echo "Version $PACKAGE_VERSION already exists. Exiting the action script."
echo "VERSION_EXISTS=true" >> $GITHUB_ENV
else
echo "Version does not exist."
echo "VERSION_EXISTS=false" >> $GITHUB_ENV
fi
- name: remove overlying workspace
if: ${{ env.VERSION_EXISTS == 'false' }}
run: rm ../../yarn.lock && rm ../../package.json
- name: Install dependencies
if: ${{ env.VERSION_EXISTS == 'false' }}
run: yarn
- name: Build
if: ${{ env.VERSION_EXISTS == 'false' }}
run: yarn tsc
- name: Bundle
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npx webpack
- name: Publish
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_DATA_STORY }}