File tree 2 files changed +32
-1
lines changed
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,25 @@ jobs:
46
46
- name : Build
47
47
run : npx rescript
48
48
49
+ - name : Pack
50
+ run : npm pack
51
+
49
52
- name : Test
50
53
env :
51
54
CI : 1
52
55
shell : bash
53
56
run : |
54
- npm pack
55
57
npm i -g ./create-rescript-app-*.tgz
56
58
npx create-rescript-app
59
+
60
+ - name : Prepare package upload
61
+ if : matrix.os == 'ubuntu-latest'
62
+ # For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
63
+ run : node .github/workflows/prepare_package_upload.js ${{ github.event.pull_request.head.sha }}
64
+
65
+ - name : " Upload artifact: npm package"
66
+ if : matrix.os == 'ubuntu-latest'
67
+ uses : actions/upload-artifact@v4
68
+ with :
69
+ name : ${{ env.artifact_filename }}
70
+ path : ${{ env.artifact_filename }}
Original file line number Diff line number Diff line change
1
+ const fs = require ( "fs" ) ;
2
+ const os = require ( "os" ) ;
3
+
4
+ const packageSpec = JSON . parse ( fs . readFileSync ( "./package.json" , "utf8" ) ) ;
5
+ const { version } = packageSpec ;
6
+
7
+ const commitHash = process . argv [ 2 ] || process . env . GITHUB_SHA ;
8
+ const commitHashShort = commitHash . substring ( 0 , 7 ) ;
9
+ const artifactFilename = `create-rescript-app-${ version } -${ commitHashShort } .tgz` ;
10
+
11
+ fs . renameSync ( `create-rescript-app-${ version } .tgz` , artifactFilename ) ;
12
+
13
+ // Pass information to subsequent GitHub actions
14
+ fs . appendFileSync (
15
+ process . env . GITHUB_ENV ,
16
+ `artifact_filename=${ artifactFilename } ${ os . EOL } `
17
+ ) ;
You can’t perform that action at this time.
0 commit comments