-
-
Notifications
You must be signed in to change notification settings - Fork 58
112 lines (107 loc) · 3.62 KB
/
release.yaml
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
name: Release v14-alpha
on:
release:
types: [published]
permissions:
contents: write
jobs:
build-matrix:
name: Build matrix
runs-on: ubuntu-latest
outputs:
build_matrix: ${{ steps.set-matrix.outputs.build_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/matrix.json
sparse-checkout-cone-mode: false
- id: set-matrix
shell: bash
run: |
if [ "$ACT" == true ]; then
echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output '[.[] | select(.RUN_LOCALLY)]' )" >> $GITHUB_OUTPUT
else
echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output )" >> $GITHUB_OUTPUT
fi
publish-npm-binaries:
name: Publish npm binaries
needs: build-matrix
runs-on: ${{ matrix.build.OS }}
strategy:
fail-fast: true
matrix:
build: ${{ fromJson(needs.build-matrix.outputs.build_matrix) }}
steps:
- name: Debug workflow values
shell: bash
run: |
echo "env.ACT : ${{ env.ACT }}"
echo "matrix.build.NAME : ${{ matrix.build.NAME }}"
echo "matrix.build.OS : ${{ matrix.build.OS }}"
echo "matrix.build.RUN_LOCALLY : ${{ matrix.build.RUN_LOCALLY }}"
echo "matrix.build.TARGET : ${{ matrix.build.TARGET }}"
- name: Checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.build.TARGET }}
override: true
components: rustfmt, clippy
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Install just
uses: extractions/setup-just@v1
with:
just-version: 1.35.0
- name: Build rust binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.build.TARGET }}
use-cross: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
- name: Publish rust binary package to npm
shell: bash
run: |
just --dotenv-filename .env.${{ matrix.build.NAME }} create-npm-binary-package
just --dotenv-filename .env.${{ matrix.build.NAME }} publish-npm-binary-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: syncpack-${{ matrix.build.TARGET }}
path: target/${{ matrix.build.TARGET }}/release/syncpack
publish-npm-base:
name: Publish npm package
needs: publish-npm-binaries
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Install just
uses: extractions/setup-just@v1
with:
just-version: 1.35.0
- name: Publish the package
shell: bash
run: |
npm install
just --dotenv-filename .env.linux-x64-glibc create-npm-root-package
just --dotenv-filename .env.linux-x64-glibc publish-npm-root-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}