-
Notifications
You must be signed in to change notification settings - Fork 182
136 lines (112 loc) · 4.34 KB
/
release.yml
File metadata and controls
136 lines (112 loc) · 4.34 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
name: Release
on:
workflow_dispatch:
permissions: {}
jobs:
build-rust:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-msvc
# - aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
submodules: true
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: release
- uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
with:
version: 0.15.2
- uses: taiki-e/install-action@ad95d4e02e061d4390c4b66ef5ed56c7fee3d2ce # v2.58.17
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tool: cargo-zigbuild
- uses: taiki-e/install-action@ad95d4e02e061d4390c4b66ef5ed56c7fee3d2ce # v2.58.17
if: ${{ contains(matrix.target, 'windows') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tool: cargo-xwin
- name: Install llvm
if: ${{ contains(matrix.target, 'windows') }}
run: brew install llvm
- name: Rustup Adds Target
run: rustup target add ${{ matrix.target }}
- name: Add musl target (x86_64)
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
run: rustup target add x86_64-unknown-linux-musl
- name: Add musl target (aarch64)
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: rustup target add aarch64-unknown-linux-musl
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- name: Build
run: pnpm --filter=@voidzero-dev/vite-plus build --target ${{ matrix.target }} -x
env:
XWIN_CACHE_DIR: ${{ github.workspace }}/.xwin-cache
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bindings-${{ matrix.target }}
path: ./packages/cli/binding/*.node
if-no-files-found: error
- name: Upload cli dist
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
with:
name: cli
path: ./packages/cli/dist
if-no-files-found: error
Release:
runs-on: ubuntu-latest
needs: build-rust
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
submodules: true
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- name: Bootstrap
run: pnpm bootstrap-cli:ci
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/cli/dist
pattern: cli
merge-multiple: true
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/cli/dist
pattern: bindings-*
merge-multiple: true
- name: Set version
run: |
sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/global/package.json
sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/cli/package.json
# Setup node correctly for publishing to github registry
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version-file: .node-version
registry-url: 'https://npm.pkg.github.com'
scope: '@voidzero-dev'
package-manager-cache: false
- run: npm install -g npm@latest # For trusted publishing support
- name: Publish
run: |
pnpm publish --filter=./packages/global --registry https://npm.pkg.github.com --no-git-checks
pnpm publish --filter=./packages/cli --registry https://npm.pkg.github.com --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}