-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (128 loc) · 4.1 KB
/
Copy pathrelease.yml
File metadata and controls
148 lines (128 loc) · 4.1 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
jobs:
build:
name: Build ${{ matrix.artifact }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- artifact: qjs-rust-x86_64-unknown-linux-gnu
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
smoke: true
- artifact: qjs-rust-aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
smoke: true
- artifact: qjs-rust-x86_64-apple-darwin
runner: macos-14
target: x86_64-apple-darwin
smoke: false
- artifact: qjs-rust-aarch64-apple-darwin
runner: macos-14
target: aarch64-apple-darwin
smoke: true
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
submodules: false
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- name: Build CLI
# Release binaries include the optional agents feature so the standalone
# CLI has the same Atomics/$262.agent support as the conformance runner.
run: cargo build --locked --release -p qjs-cli --features agents --target ${{ matrix.target }}
- name: Package CLI
shell: bash
run: |
set -euo pipefail
package="${{ matrix.artifact }}"
mkdir -p "dist/$package"
cp "target/${{ matrix.target }}/release/qjs" "dist/$package/qjs-rust"
chmod +x "dist/$package/qjs-rust"
cp README.md LICENSE "dist/$package/"
tar -C dist -czf "dist/$package.tar.gz" "$package"
- name: Smoke test packaged binary
if: ${{ matrix.smoke }}
shell: bash
run: |
set -euo pipefail
"dist/${{ matrix.artifact }}/qjs-rust" --version
actual="$("dist/${{ matrix.artifact }}/qjs-rust" --raw -e '1 + 2')"
test "$actual" = "3"
- name: Inspect cross-built binary
if: ${{ !matrix.smoke }}
shell: bash
run: |
set -euo pipefail
file "dist/${{ matrix.artifact }}/qjs-rust"
- name: Upload release artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}.tar.gz
if-no-files-found: error
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
submodules: false
- name: Download artifacts
uses: actions/download-artifact@v7
with:
pattern: qjs-rust-*
path: dist
merge-multiple: true
- name: Generate checksums
shell: bash
run: |
set -euo pipefail
cd dist
sha256sum *.tar.gz > SHA256SUMS
- name: Publish release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
shell: bash
run: |
set -euo pipefail
cat > dist/RELEASE_NOTES.md <<'NOTES'
Standalone qjs-rust CLI binaries for Linux and macOS.
Install or update:
```sh
curl -fsSL https://raw.githubusercontent.com/Lewin671/quickjs-rust/main/install.sh | sh -s -- --upgrade
```
Start the interactive shell:
```sh
qjs-rust
```
NOTES
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
gh release upload "$TAG_NAME" dist/*.tar.gz dist/SHA256SUMS --clobber
else
gh release create "$TAG_NAME" dist/*.tar.gz dist/SHA256SUMS \
--title "$TAG_NAME" \
--notes-file dist/RELEASE_NOTES.md \
--verify-tag
fi