File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @param {string | number } value
3+ * @param {number } length
4+ */
5+ function padInt ( value , length ) {
6+ value = value . toString ( ) ;
7+ while ( value . length < length ) {
8+ value = "0" + value ;
9+ }
10+ return value ;
11+ }
12+
13+ const version = process . argv [ 2 ] ;
14+ if ( ! version || ! / \d + \. \d + \. \d + / . test ( version ) ) {
15+ throw new Error ( `Must provide base version, e.g. 'node getVersion.js 2.0.0'` ) ;
16+ }
17+ const date = new Date ( ) ;
18+ const timestamp = [
19+ date . getUTCFullYear ( ) ,
20+ padInt ( date . getUTCMonth ( ) + 1 , 2 ) ,
21+ padInt ( date . getUTCDate ( ) , 2 ) ,
22+ ] . join ( '' ) ;
23+
24+ console . log ( `${ version } -alpha.${ timestamp } ` ) ;
Original file line number Diff line number Diff line change 5151 run : npm publish
5252 env :
5353 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
54+ publish_alpha :
55+ if : github.event_name == 'push' && github.ref == 'v2'
56+ needs : build_test
57+ name : publish alpha version to npm
58+ runs-on : ubuntu-latest
59+ steps :
60+ - uses : actions/checkout@v1
61+ - uses : actions/setup-node@v1
62+ with :
63+ node-version : ' 12'
64+ registry-url : ' https://registry.npmjs.org'
65+ - name : install
66+ run : npm ci
67+ - name : build
68+ run : npm run build
69+ - name : publish alpha
70+ run : |
71+ version=`node .github/workflows/getVersion.js 2.0.0`
72+ npm --no-git-tag-version version $version
73+ npm publish --tag alpha
You can’t perform that action at this time.
0 commit comments