|
1 | | -name: Build and Release Binaries |
| 1 | +name: Build Release Artifacts |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - 'v*' |
7 | 7 | workflow_dispatch: |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
9 | 12 | jobs: |
10 | 13 | build: |
| 14 | + name: ${{ matrix.package }} |
| 15 | + runs-on: ${{ matrix.runs_on }} |
11 | 16 | strategy: |
12 | 17 | fail-fast: false |
13 | 18 | matrix: |
14 | | - settings: |
15 | | - - host: macos-latest |
16 | | - target: x86_64-apple-darwin |
17 | | - build: yarn build:rs --target x86_64-apple-darwin |
18 | | - - host: macos-latest |
19 | | - target: aarch64-apple-darwin |
20 | | - build: yarn build:rs --target aarch64-apple-darwin |
21 | | - - host: windows-latest |
22 | | - target: x86_64-pc-windows-msvc |
23 | | - build: yarn build:rs --target x86_64-pc-windows-msvc |
24 | | - - host: windows-latest |
25 | | - target: i686-pc-windows-msvc |
26 | | - build: yarn build:rs --target i686-pc-windows-msvc |
27 | | - - host: ubuntu-latest |
28 | | - target: x86_64-unknown-linux-gnu |
29 | | - build: yarn build:rs --target x86_64-unknown-linux-gnu |
30 | | - - host: ubuntu-latest |
31 | | - target: x86_64-unknown-linux-musl |
32 | | - build: | |
33 | | - sudo apt-get update |
34 | | - sudo apt-get install musl-tools |
35 | | - yarn build:rs --target x86_64-unknown-linux-musl |
36 | | - - host: ubuntu-latest |
37 | | - target: aarch64-unknown-linux-gnu |
38 | | - build: | |
39 | | - sudo apt-get update |
40 | | - sudo apt-get install gcc-aarch64-linux-gnu |
41 | | - yarn build:rs --target aarch64-unknown-linux-gnu |
42 | | - - host: ubuntu-latest |
43 | | - target: i686-unknown-linux-gnu |
44 | | - build: | |
45 | | - sudo apt-get update |
46 | | - sudo apt-get install gcc-multilib |
47 | | - yarn build:rs --target i686-unknown-linux-gnu |
48 | | - - host: ubuntu-latest |
49 | | - target: armv7-unknown-linux-gnueabihf |
50 | | - build: | |
51 | | - sudo apt-get update |
52 | | - sudo apt-get install gcc-arm-linux-gnueabihf |
53 | | - yarn build:rs --target armv7-unknown-linux-gnueabihf |
54 | | - - host: ubuntu-latest |
55 | | - target: x86_64-unknown-freebsd |
56 | | - build: yarn build:rs --target x86_64-unknown-freebsd |
| 19 | + include: |
| 20 | + - runs_on: macos-14 |
| 21 | + package: idea-node-darwin-arm64 |
| 22 | + binary: idea_node.darwin-arm64.node |
| 23 | + |
| 24 | + - runs_on: macos-13 |
| 25 | + package: idea-node-darwin-x64 |
| 26 | + binary: idea_node.darwin-x64.node |
57 | 27 |
|
58 | | - name: Build ${{ matrix.settings.target }} |
59 | | - runs-on: ${{ matrix.settings.host }} |
| 28 | + - runs_on: ubuntu-24.04 |
| 29 | + package: idea-node-linux-x64-gnu |
| 30 | + binary: idea_node.linux-x64-gnu.node |
| 31 | + |
| 32 | + - runs_on: windows-2022 |
| 33 | + package: idea-node-win32-x64-msvc |
| 34 | + binary: idea_node.win32-x64-msvc.node |
60 | 35 |
|
61 | 36 | steps: |
62 | 37 | - uses: actions/checkout@v4 |
63 | 38 |
|
64 | | - - name: Setup Node.js |
| 39 | + - name: Set up Node.js |
65 | 40 | uses: actions/setup-node@v4 |
66 | 41 | with: |
67 | | - node-version: '18' |
| 42 | + node-version: '22.14.0' |
68 | 43 | cache: 'yarn' |
69 | 44 |
|
70 | | - - name: Setup Rust |
| 45 | + - name: Set up Rust |
71 | 46 | uses: dtolnay/rust-toolchain@stable |
72 | | - with: |
73 | | - targets: ${{ matrix.settings.target }} |
74 | | - |
75 | | - - name: Cache cargo |
76 | | - uses: actions/cache@v4 |
77 | | - with: |
78 | | - path: | |
79 | | - ~/.cargo/registry/index/ |
80 | | - ~/.cargo/registry/cache/ |
81 | | - ~/.cargo/git/db/ |
82 | | - .cargo-cache |
83 | | - target/ |
84 | | - key: ${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
85 | 47 |
|
86 | 48 | - name: Install dependencies |
87 | | - run: yarn install --frozen-lockfile |
| 49 | + run: yarn install --ignore-scripts |
88 | 50 |
|
89 | | - - name: Build binary |
90 | | - run: ${{ matrix.settings.build }} |
| 51 | + - name: Build host binary |
| 52 | + run: yarn --cwd packages/idea-node build |
91 | 53 |
|
92 | | - - name: Upload binary |
| 54 | + - name: Upload platform artifact |
93 | 55 | uses: actions/upload-artifact@v4 |
94 | 56 | with: |
95 | | - name: binaries-${{ matrix.settings.target }} |
| 57 | + name: ${{ matrix.package }} |
96 | 58 | path: | |
97 | | - *.node |
98 | | - cjs/*.node |
99 | | - esm/*.node |
100 | | -
|
101 | | - release: |
102 | | - name: Create Release |
103 | | - runs-on: ubuntu-latest |
104 | | - needs: build |
105 | | - if: startsWith(github.ref, 'refs/tags/') |
106 | | - |
107 | | - steps: |
108 | | - - uses: actions/checkout@v4 |
109 | | - |
110 | | - - name: Download all artifacts |
111 | | - uses: actions/download-artifact@v4 |
112 | | - with: |
113 | | - path: artifacts |
114 | | - |
115 | | - - name: Create Release |
116 | | - id: create_release |
117 | | - uses: actions/create-release@v1 |
118 | | - env: |
119 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
120 | | - with: |
121 | | - tag_name: ${{ github.ref }} |
122 | | - release_name: Release ${{ github.ref }} |
123 | | - draft: false |
124 | | - prerelease: false |
125 | | - |
126 | | - - name: Upload Release Assets |
127 | | - run: | |
128 | | - for dir in artifacts/binaries-*; do |
129 | | - target=$(basename "$dir" | sed 's/binaries-//') |
130 | | - for file in "$dir"/*.node; do |
131 | | - if [ -f "$file" ]; then |
132 | | - asset_name="idea-parser-${target}.node" |
133 | | - echo "Uploading $file as $asset_name" |
134 | | - curl \ |
135 | | - -X POST \ |
136 | | - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
137 | | - -H "Content-Type: application/octet-stream" \ |
138 | | - --data-binary @"$file" \ |
139 | | - "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$asset_name" |
140 | | - fi |
141 | | - done |
142 | | - done |
| 59 | + packages/${{ matrix.package }}/package.json |
| 60 | + packages/${{ matrix.package }}/${{ matrix.binary }} |
0 commit comments