-
Notifications
You must be signed in to change notification settings - Fork 4
137 lines (119 loc) · 3.6 KB
/
Copy pathbuild.yml
File metadata and controls
137 lines (119 loc) · 3.6 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
name: Build Binaries
permissions:
contents: write
id-token: write
attestations: write
defaults:
run:
shell: bash
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag/version to build. Defaults to package.json version.'
required: false
type: string
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Fetch Repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24.13.0
cache: 'npm'
- name: Get Package Version
id: package-version
run: |
release_tag="${{ inputs.release_tag }}"
if [ -z "$release_tag" ]; then
release_tag="$(node -p "require('./package').version")"
fi
echo "version=$release_tag" >> "$GITHUB_OUTPUT"
- name: Create Draft Release
id: create_release
uses: softprops/action-gh-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package-version.outputs.version }}
name: Release ${{ steps.package-version.outputs.version }}
build:
name: Build ${{ matrix.target }}
needs: create_release
strategy:
fail-fast: false
matrix:
include:
- target: windows-x64
os: windows-2022
node_arch: x64
archflags: ''
- target: windows-arm64
os: windows-11-arm
node_arch: arm64
archflags: ''
- target: linux-x64
os: ubuntu-22.04
node_arch: x64
archflags: ''
- target: linux-arm64
os: ubuntu-22.04-arm
node_arch: arm64
archflags: ''
- target: darwin-x64
os: macos-26-intel
node_arch: x64
archflags: '-arch x86_64'
- target: darwin-arm64
os: macos-26
node_arch: arm64
archflags: '-arch arm64'
runs-on: ${{ matrix.os }}
steps:
- name: Fetch Repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24.13.0
architecture: ${{ matrix.node_arch }}
cache: 'npm'
- name: Install Modules
run: npm ci
- name: Build Current Binary
env:
ARCHFLAGS: ${{ matrix.archflags }}
run: npm run build:rebuild
- name: Get Package Version
id: package-version
run: |
release_tag="${{ inputs.release_tag }}"
if [ -z "$release_tag" ]; then
release_tag="$(node -p "require('./package').version")"
fi
echo "version=$release_tag" >> "$GITHUB_OUTPUT"
- name: Pack Files
id: pack-files
run: node -e "import('@node-3d/addon-tools').then((m) => m.actionPack())" >> "$GITHUB_OUTPUT"
- name: Attest Binary Archive
uses: actions/attest@v4
with:
subject-path: ${{ steps.pack-files.outputs.pack }}
- name: Store Binaries
uses: softprops/action-gh-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package-version.outputs.version }}
name: Release ${{ steps.package-version.outputs.version }}
files: ${{ steps.pack-files.outputs.pack }}