File tree Expand file tree Collapse file tree 3 files changed +62
-91
lines changed
actions/build-test-publish Expand file tree Collapse file tree 3 files changed +62
-91
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ workflow_call :
5+
6+ jobs :
7+ release :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - name : Setup node
12+ uses : actions/setup-node@v4
13+ with :
14+ node-version : ${{ vars.NODE_VERSION }}
15+ registry-url : https://registry.npmjs.org/
16+
17+ - name : Checkout
18+ uses : actions/checkout@v4
19+
20+ - name : Start terminal session (pre build)
21+ if : vars.TERMINAL_PRE_BUILD == 'true'
22+ uses : mxschmitt/action-tmate@v3
23+
24+ - name : Build
25+ run : |
26+ npm install
27+
28+ # Project must have build-dist script.
29+ npm run build-dist
30+
31+ - name : Start terminal session (post build)
32+ if : vars.TERMINAL_POST_BUILD == 'true'
33+ uses : mxschmitt/action-tmate@v3
34+
35+ - name : Test
36+ run : |
37+ # Run test script if present.
38+ npm run test --if-present
39+
40+ - name : Publish
41+ env :
42+ NODE_AUTH_TOKEN : ${{ secrets.NODE_AUTH_TOKEN }}
43+ run : |
44+ # Get the tag on the version property if any.
45+ tag=`grep "^ \"version\": " package.json | cut -d "\"" -f4 -s | cut -d "-" -f2 -s`
46+
47+ # If release is not official, tag it with the release phase.
48+ if [ "$tag" != "" ]
49+ then
50+ tag_args="--tag $tag"
51+ fi
52+
53+ if [ "${{ github.event_name }}" != "release" ]
54+ then
55+ dry_run_arg="--dry-run"
56+ fi
57+
58+ # Create .npmignore to exclude hidden directories.
59+ echo /.\*/ > .npmignore
60+
61+ npm publish --access public $tag_args $dry_run_arg
Original file line number Diff line number Diff line change 1010
1111jobs :
1212 release :
13- runs-on : ubuntu-latest
14-
15- if : github.event_name == 'release'
16-
17- steps :
18- - name : Build, test, and publish (release)
19- uses : legreq/tsdev/.github/actions/build-test-publish@main
20- with :
21- secrets : ${{ toJSON(secrets) }}
22- vars : ${{ toJSON(vars) }}
23-
24- test :
25- runs-on : ubuntu-latest
26-
27- if : github.event_name != 'release'
28-
29- steps :
30- - name : Build, test, and publish (test)
31- uses : legreq/tsdev/.github/actions/build-test-publish@test-release
32- with :
33- secrets : ${{ toJSON(secrets) }}
34- vars : ${{ toJSON(vars) }}
13+ uses : legreq/tsdev/.github/workflows/_release@main
You can’t perform that action at this time.
0 commit comments