File tree 4 files changed +7524
-1376
lines changed
4 files changed +7524
-1376
lines changed Original file line number Diff line number Diff line change 1
1
name : CI
2
2
3
+ # Workflow name based on selected inputs. Fallback to default Github naming when expression evaluates to empty string
4
+ run-name : >-
5
+ ${{
6
+ inputs.release && 'CI ➤ Publish to NPM' ||
7
+ ''
8
+ }}
9
+
3
10
on :
4
11
pull_request :
5
12
push :
6
13
branches : [main]
14
+ workflow_dispatch :
15
+ inputs :
16
+ release :
17
+ description : ' Publish new release'
18
+ required : true
19
+ default : false
20
+ type : boolean
7
21
8
22
concurrency :
9
23
group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20
34
cache : npm
21
35
- run : npm ci
22
36
- run : npm test
37
+
38
+ release :
39
+ needs : [test]
40
+ # only run if opt-in during workflow_dispatch
41
+ if : always() && github.event.inputs.release == 'true'
42
+ runs-on : ubuntu-latest
43
+ steps :
44
+ - uses : actions/checkout@v3
45
+ with :
46
+ # Need to fetch entire commit history to
47
+ # analyze every commit since last release
48
+ fetch-depth : 0
49
+ - uses : actions/setup-node@v3
50
+ with :
51
+ node-version : lts/*
52
+ cache : npm
53
+ - run : npm ci
54
+ # Branches that will release new versions are defined in .releaserc.json
55
+ - run : npx semantic-release
56
+ # Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
57
+ # e.g. git tags were pushed but it exited before `npm publish`
58
+ if : always()
59
+ env :
60
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61
+ NPM_TOKEN : ${{ secrets.NPM_PUBLISH_TOKEN }}
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " @sanity/semantic-release-preset" ,
3
+ "branches" : [" main" ]
4
+ }
You can’t perform that action at this time.
0 commit comments