forked from boa-dev/boa
-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (103 loc) · 3.19 KB
/
release.yml
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
name: Publish Release
on:
release:
types: [published]
jobs:
publish:
name: Publish crates
runs-on: ubuntu-latest
timeout-minutes: 60
env:
RUSTFLAGS: ${{ github.ref == 'refs/heads/main' && '-D warnings' || '' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install cargo-workspaces
run: cargo install cargo-workspaces
- name: Release
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
PATCH: ${{ github.run_number }}
shell: bash
run: |
git config --global user.email "runner@gha.local"
git config --global user.name "Github Action"
cargo workspaces publish \
--from-git \
--yes \
--no-git-commit \
skip
npm_publish:
name: Publish NPM package (wasm)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'latest'
- name: Build boa_wasm
run: wasm-pack build --scope boa-dev ./ffi/wasm
- name: Set-up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Set-up npm config for publishing
run: npm config set -- '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"
- name: Publish to npm
run: npm publish ./ffi/wasm/pkg --access=public
release-binaries:
name: Publish binaries
needs: publish
strategy:
fail-fast: false
matrix:
build: [linux, macos, win-msvc]
include:
- build: linux
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-gnu
asset_name: boa-linux-amd64
binary_name: boa
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
asset_name: boa-macos-amd64
binary_name: boa
- build: win-msvc
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc
asset_name: boa-windows-amd64.exe
binary_name: boa.exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Build
run: cargo build --target ${{ matrix.target }} --verbose --release --locked --bin boa
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/${{ matrix.binary_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}