File tree 2 files changed +55
-0
lines changed
2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 24
24
- name : Build
25
25
run : yarn build
26
26
27
+ - name : Upload build artifact
28
+ uses : actions/upload-artifact@v2
29
+ with :
30
+ name : dist
31
+ path : |
32
+ dist/**/*
33
+ if-no-files-found : error
34
+
27
35
test :
28
36
runs-on : ubuntu-latest
29
37
env :
51
59
52
60
- name : Run tests
53
61
run : yarn test --runInBand
62
+
63
+ publishRelease :
64
+ name : Potentially publish release
65
+ runs-on : ubuntu-latest
66
+ needs : [build, test]
67
+ if : github.ref == 'refs/heads/main'
68
+ env :
69
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
70
+
71
+ steps :
72
+ - uses : actions/checkout@v2
73
+ with :
74
+ fetch-depth : 25
75
+
76
+ - run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
77
+
78
+ - name : Download build artifact
79
+ uses : actions/download-artifact@v2
80
+ with :
81
+ name : dist
82
+
83
+ - run : ./scripts/publish-release.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ git describe --exact-match
4
+
5
+ if [[ ! $? -eq 0 ]]; then
6
+ echo " Nothing to publish, exiting.."
7
+ exit 0;
8
+ fi
9
+
10
+ if [[ -z " $NPM_TOKEN " ]]; then
11
+ echo " No NPM_TOKEN, exiting.."
12
+ exit 0;
13
+ fi
14
+
15
+ echo " //registry.npmjs.org/:_authToken=$NPM_TOKEN " >> ~ /.npmrc
16
+
17
+ if [[ $( git describe --match " v[0-9]*" --abbrev=0 HEAD 2> /dev/null) ]]; then
18
+ echo " Publishing version"
19
+ npm publish --access public
20
+
21
+ # Make sure to exit script with code 1 if publish failed
22
+ if [[ ! $? -eq 0 ]]; then
23
+ exit 1;
24
+ fi
25
+ fi
You can’t perform that action at this time.
0 commit comments