This repository was archived by the owner on Mar 23, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +47
-18
lines changed Expand file tree Collapse file tree 4 files changed +47
-18
lines changed Original file line number Diff line number Diff line change 43
43
- name : Build ${{ matrix.os }} release binary
44
44
run : make release
45
45
46
+ - name : Use Node.js 10.x
47
+ uses : actions/setup-node@v1
48
+ with :
49
+ node-version : 10.x
50
+
51
+ - name : Create archive
52
+ if : startsWith(github.ref, 'refs/tags/')
53
+ shell : bash
54
+ run : |
55
+ VERSION=$(git describe --tags)
56
+
57
+ # We need to do bash -c to make sure this also works on GitBash for Windows.
58
+ # GitHub actions uses GitBash for Windows if we say 'shell: bash' on a Windows executor.
59
+ ARCHIVE=$(bash -c "node .npm/printArchiveName.js ${VERSION}")
60
+
61
+ tar czvf ${ARCHIVE} -C target/release ${{ matrix.binary }}
62
+
63
+ - name : Upload asset to GitHub release
64
+ uses : softprops/action-gh-release@v1
65
+ if : startsWith(github.ref, 'refs/tags/')
66
+ with :
67
+ files : create-comit-app_*.tar.gz
68
+ env :
69
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
70
+
46
71
npm_build :
47
72
name : NPM Project
48
73
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1
1
const fs = require ( "fs" ) ;
2
2
const util = require ( "util" ) ;
3
- const exec = util . promisify ( require ( "child_process" ) . exec ) ;
4
3
const extract = util . promisify ( require ( "targz" ) . decompress ) ;
5
4
const axios = require ( "axios" ) ;
6
5
const path = require ( "path" ) ;
7
-
8
- async function getSystem ( ) {
9
- const { stdout } = await exec ( "uname -s" ) ;
10
- return stdout . trim ( ) ;
11
- }
12
-
13
- async function getArch ( ) {
14
- const { stdout } = await exec ( "uname -m" ) ;
15
- return stdout . trim ( ) ;
16
- }
6
+ const makeArchiveName = require ( "./makeArchiveName" ) . default ;
17
7
18
8
async function download ( version , binTarget ) {
19
- const system = await getSystem ( ) ;
20
- const arch = await getArch ( ) ;
21
- if ( ! version || ! system || ! arch ) {
22
- throw new Error ( "Could not retrieve needed information." ) ;
23
- }
24
-
25
9
const targetDir = path . dirname ( binTarget ) ;
26
10
27
- const archiveName = `create-comit-app_ ${ version } _ ${ system } _ ${ arch } .tar.gz` ;
11
+ const archiveName = makeArchiveName ( version ) ;
28
12
const archivePath = targetDir + "/" + archiveName ;
29
13
30
14
if ( ! fs . existsSync ( targetDir ) ) {
Original file line number Diff line number Diff line change
1
+ const os = require ( "os" ) ;
2
+
3
+ exports . default = function makeArchiveName ( version ) {
4
+ const kernel = os . type ( ) ;
5
+ const arch = os . arch ( ) ;
6
+
7
+ return `create-comit-app_${ version } _${ kernel } _${ arch } .tar.gz` ;
8
+ } ;
Original file line number Diff line number Diff line change
1
+ const makeArchiveName = require ( "./makeArchiveName" ) . default ;
2
+
3
+ const version = process . argv [ 2 ] ;
4
+
5
+ if ( ! version ) {
6
+ console . error ( "Please pass the version as the first argument." ) ;
7
+ process . exit ( 1 ) ;
8
+ }
9
+
10
+ const archiveName = makeArchiveName ( version ) ;
11
+
12
+ console . log ( archiveName ) ;
You can’t perform that action at this time.
0 commit comments