1
- name : Build Assets
1
+ name : Release
2
2
3
3
on :
4
4
release :
5
- types :
6
- - published
5
+ types : [published]
6
+ workflow_dispatch :
7
7
8
8
jobs :
9
- compile_core :
10
- name : compile_core
11
- runs-on : macos-latest
12
- steps :
13
- - uses : actions/checkout@v3
14
-
15
- - name : Install target
16
- run : rustup target add wasm32-wasi
17
-
18
- - name : Install wasi-sdk
19
- working-directory : ts/compile/builder
20
- run : make download-wasi-sdk
21
-
22
- - name : Install wizer
23
- working-directory : ts/compile/builder
24
- run : cargo install wizer --all-features
25
-
26
- - name : Make core
27
- working-directory : ts/compile/builder
28
- run : make core
29
-
30
- - name : Upload core binary to artifacts
31
- uses : actions/upload-artifact@v3
32
- with :
33
- name : engine
34
- path : ts/compile/builder/target/wasm32-wasi/release/jsbuilder_core.wasm
35
-
36
- compile_cli :
37
- name : compile_cli-${{ matrix.name }}
38
- needs : compile_core
39
- runs-on : ${{ matrix.os }}
40
- strategy :
41
- matrix :
42
- include :
43
- - name : linux
44
- os : ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
45
- path : target/x86_64-unknown-linux-gnu/release/jsbuilder
46
- artifact_name : jsbuilder-x86_64-linux
47
- asset_name : jsbuilder-x86_64-linux-${{ github.event.release.tag_name }}
48
- shasum_cmd : sha256sum
49
- target : x86_64-unknown-linux-gnu
50
- - name : linux-arm64
51
- os : ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
52
- path : target/aarch64-unknown-linux-gnu/release/jsbuilder
53
- artifact_name : jsbuilder-arm-linux
54
- asset_name : jsbuilder-arm-linux-${{ github.event.release.tag_name }}
55
- shasum_cmd : sha256sum
56
- target : aarch64-unknown-linux-gnu
57
- - name : macos
58
- os : macos-latest
59
- path : target/x86_64-apple-darwin/release/jsbuilder
60
- artifact_name : jsbuilder-x86_64-macos
61
- asset_name : jsbuilder-x86_64-macos-${{ github.event.release.tag_name }}
62
- shasum_cmd : shasum -a 256
63
- target : x86_64-apple-darwin
64
- - name : macos-arm64
65
- os : macos-latest
66
- path : target/aarch64-apple-darwin/release/jsbuilder
67
- artifact_name : jsbuilder-arm-macos
68
- asset_name : jsbuilder-arm-macos-${{ github.event.release.tag_name }}
69
- shasum_cmd : shasum -a 256
70
- target : aarch64-apple-darwin
71
- - name : windows
72
- os : windows-latest
73
- path : target\x86_64-pc-windows-msvc\release\jsbuilder.exe
74
- artifact_name : jsbuilder-x86_64-windows
75
- asset_name : jsbuilder-x86_64-windows-${{ github.event.release.tag_name }}
76
- shasum_cmd : sha256sum
77
- target : x86_64-pc-windows-msvc
78
-
9
+ npm :
10
+ runs-on : ubuntu-latest
79
11
steps :
80
- - uses : actions/checkout@v3
81
-
82
- # Should no-op except for macos-arm and linux-arm cases where that target won't be installed
83
- - name : Install target
84
- run : rustup target add ${{ matrix.target }}
85
-
86
- # wasmtime-fiber and binaryen fail to compile without this
87
- - name : Install Aarch64 GCC toolchain
88
- run : sudo apt-get --assume-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
89
- if : matrix.target == 'aarch64-unknown-linux-gnu'
90
-
91
- - uses : actions/download-artifact@v3
12
+ - name : Checkout
13
+ uses : actions/checkout@v3
14
+ - name : Setup node
15
+ uses : actions/setup-node@v3
92
16
with :
93
- name : engine
94
- path : ts/compile/builder/target/wasm32-wasi/release/
95
-
96
- - name : Build CLI ${{ matrix.os }}
97
- working-directory : ts/compile/builder
98
- run : cargo build --release --target ${{ matrix.target }} --package jsbuilder
99
- env :
100
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER : aarch64-linux-gnu-gcc
101
-
102
- - name : Archive assets
103
- run : gzip -k -f ts/compile/builder/${{ matrix.path }} && mv ts/compile/builder/${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz
104
-
105
- - name : Copy for artifact
106
- run : cp ${{ matrix.asset_name }}.gz ${{ matrix.artifact_name }}.gz
107
-
108
- - name : Upload assets to artifacts
109
- uses : actions/upload-artifact@v3
17
+ node-version : " 20"
18
+ registry-url : " https://registry.npmjs.org"
19
+ - name : Cache the dependency directories
20
+ uses : actions/cache@v3
110
21
with :
111
- name : ${{ matrix.artifact_name }}.gz
112
- path : ${{ matrix.artifact_name }}.gz
113
-
114
- - name : Upload assets to release
115
- if : github.event_name == 'release'
22
+ path : node_modules
23
+ key : ${{ runner.os }}-${{ hashFiles('*.json') }}
24
+ - name : Install dependencies with npm
25
+ run : npm install --save-dev
26
+ - name : Build with npm
27
+ run : npm run build
28
+ - name : Publish to npm
29
+ run : npm publish --access public
30
+ working-directory : ./dist
116
31
env :
117
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118
- run : gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz
119
-
120
- pull-request :
121
- runs-on : ubuntu-latest
122
- needs : compile_cli
123
- steps :
124
-
125
- - name : Create dir
126
- run : mkdir releases
127
-
128
- - uses : actions/download-artifact@v3
129
- with :
130
- name : jsbuilder-x86_64-linux.gz
131
- path : releases/
132
-
133
- - uses : actions/download-artifact@v3
134
- with :
135
- name : jsbuilder-arm-linux.gz
136
- path : releases/
137
-
138
- - uses : actions/download-artifact@v3
139
- with :
140
- name : jsbuilder-x86_64-macos.gz
141
- path : releases/
142
-
143
- - uses : actions/download-artifact@v3
144
- with :
145
- name : jsbuilder-arm-macos.gz
146
- path : releases/
147
-
148
- - uses : actions/download-artifact@v3
149
- with :
150
- name : jsbuilder-x86_64-windows.gz
151
- path : releases/
152
-
153
- - name : Create version file
154
- run : echo ${{ github.event.release.tag_name }} > releases/jsbuilder-version.txt
155
-
156
- - name : Create pull request
157
-
158
- env :
159
- API_TOKEN_GITHUB : ${{ secrets.API_TOKEN_GITHUB }}
160
- with :
161
- source_folder : ' releases'
162
- destination_repo : ' loopholelabs/scale-cli'
163
- destination_folder : ' pkg/build'
164
- destination_base_branch : ' staging'
165
- destination_head_branch : ' jsbuilder-${{ github.event.release.tag_name }}'
166
-
167
- user_name : ' workflow'
168
- pull_request_reviewers : ' '
32
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_AUTH_TOKEN }}
33
+ # cargo:
34
+ # runs-on: ubuntu-latest
35
+ # steps:
36
+ # - name: Checkout
37
+ # uses: actions/checkout@v3
38
+ # - name: Set up Rust
39
+ # run: |
40
+ # rustup toolchain install stable --profile minimal --no-self-update
41
+ # rustup default stable
42
+ # shell: bash
43
+ # - name: Cargo build
44
+ # run: cargo build --release
45
+ # - name: Publish to crates.io
46
+ # run: cargo publish --token $CARGO_REGISTRY_TOKEN
47
+ # env:
48
+ # CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
0 commit comments