forked from xarantolus/ax
-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (141 loc) · 3.79 KB
/
release.yml
File metadata and controls
169 lines (141 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Release
on:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: "Check & Test"
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Run tests
run: make precommit
build-windows:
name: "Build for Windows"
runs-on: windows-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build executable
run: make bin
- name: Upload executable
uses: actions/upload-artifact@v2
with:
name: ax.exe
path: target/release/ax.exe
build-linux:
name: "Build for Linux"
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build executable
run: make bin
- name: Upload executable
uses: actions/upload-artifact@v2
with:
name: ax
path: target/release/ax
build-wasm:
name: "Build for WebAssembly"
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build WebAssembly module
run: make build
- name: Upload WebAssembly module
uses: actions/upload-artifact@v2
with:
name: pkg
path: pkg/
release:
name: Release
runs-on: ubuntu-latest
needs: [test, build-windows, build-linux, build-wasm]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Pull latest tags
run: git fetch --prune --unshallow --tags
- name: Check if tag to be created does not yet exist
run: |
TAG=v$(awk '$1 == "version" {print $3}' Cargo.toml | head | tr -d "\"" | head -n1)
if git rev-parse $TAG >/dev/null 2>&1; then
echo "Tag $TAG already exists"
exit 1
fi
echo "TAG=$TAG" >> $GITHUB_ENV
continue-on-error: true
- name: Download Windows executable
uses: actions/download-artifact@v2
with:
name: ax.exe
if: env.TAG
- name: Download Linux executable
uses: actions/download-artifact@v2
with:
name: ax
if: env.TAG
- name: Download WebAssembly module
uses: actions/download-artifact@v2
with:
name: pkg
path: pkg
if: env.TAG
- name: Log in to NPM
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
if: env.TAG
- name: Publish to NPM
working-directory: pkg
run: npm publish
if: env.TAG
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
pkg/*
ax.exe
ax
tag_name: ${{ needs.test.outputs.tag }}
draft: true
fail_on_unmatched_files: true
generate_release_notes: true
if: env.TAG