-
Notifications
You must be signed in to change notification settings - Fork 8
148 lines (126 loc) · 4.12 KB
/
Copy pathrelease.yml
File metadata and controls
148 lines (126 loc) · 4.12 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
138
139
140
141
142
143
144
145
146
147
148
name: Release
on:
pull_request:
types: [closed]
branches:
- main
permissions:
contents: read
id-token: write
concurrency:
group: release-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'changeset-release/main' &&
github.repository_owner == 'Effect-TS'
name: Build ${{ matrix.binary.name }} ${{ matrix.npm_target }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
npm_target:
- darwin-arm64
- darwin-x64
- win32-x64
- win32-arm64
- linux-x64
- linux-arm64
- linux-arm
binary:
- name: tsgo
ref: main
- name: tsc
ref: generated/stable
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.binary.ref }}
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
cache-dependency-path: "**/go.sum"
- name: Cache Go build
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: go-build-release-${{ matrix.binary.name }}-${{ matrix.npm_target }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
go-build-release-${{ matrix.binary.name }}-${{ matrix.npm_target }}-
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup repo
run: pnpm setup-repo --ci
- name: Build ${{ matrix.binary.name }} ${{ matrix.npm_target }}
run: pnpm release:prepare --target ${{ matrix.npm_target }} --binary-name ${{ matrix.binary.name }} --skip-cli
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary.name }}-${{ matrix.npm_target }}
path: _packages/tsgo-${{ matrix.npm_target }}/lib/${{ matrix.binary.name }}${{ startsWith(matrix.npm_target, 'win32-') && '.exe' || '' }}
publish:
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'changeset-release/main' &&
github.repository_owner == 'Effect-TS'
name: Publish Packages
runs-on: ubuntu-latest
needs: [build]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Upgrade npm for publish support
run: npm install -g npm@latest
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download platform binaries
uses: actions/download-artifact@v4
with:
path: _release-artifacts
- name: Copy binaries into platform packages
run: |
for artifact_dir in _release-artifacts/*-*; do
artifact_name="${artifact_dir##*/}"
binary_name="${artifact_name%%-*}"
npm_target="${artifact_name#*-}"
package_dir="_packages/tsgo-${npm_target}/lib"
mkdir -p "${package_dir}"
if [ -f "${artifact_dir}/${binary_name}.exe" ]; then
cp "${artifact_dir}/${binary_name}.exe" "${package_dir}/${binary_name}.exe"
else
cp "${artifact_dir}/${binary_name}" "${package_dir}/${binary_name}"
fi
done
- name: Build CLI bundle
run: pnpm build:cli
- name: Publish packages
run: pnpm changeset:publish
env:
NPM_CONFIG_PROVENANCE: "true"