Repository navigation
217 lines (196 loc) · 7.88 KB
/
Copy pathcreate-release.yml
File metadata and controls
217 lines (196 loc) · 7.88 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Create Release/Upload Asset
# Builds the default library with a released compiler and publishes it as a draft release. A pushed
# tag releases; a manual run only builds, and leaves the archives as artifacts of the run.
on:
workflow_dispatch:
inputs:
compiler_tag:
description: TypeScriptCompiler release to build with (empty - the newest one)
required: false
default: ''
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
env:
# release archives carry the version (the pushed tag) and the OS they were built on, as the
# compiler's do: defaultlib-v1.0-windows-x64.zip, defaultlib-v1.0-ubuntu-24.04-x64.tar.gz
ASSET_NAME: defaultlib-${{ github.ref_name }}
COMPILER_REPO: ASDAlexander77/TypeScriptCompiler
GH_TOKEN: ${{ github.token }}
jobs:
compiler:
name: Pick the compiler release
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
# Every release so far is a prerelease, which /releases/latest does not return. One tag for
# every build, so the archives of a release cannot come from different compilers.
- name: Resolve the tag
id: tag
shell: bash
env:
REQUESTED_TAG: ${{ inputs.compiler_tag }}
run: |
tag="$REQUESTED_TAG"
if [ -z "$tag" ]; then
tag=$(gh api "repos/$COMPILER_REPO/releases?per_page=10" --jq '[.[] | select(.draft | not)][0].tag_name')
fi
if [ -z "$tag" ]; then echo "no release found in $COMPILER_REPO"; exit 1; fi
echo "Compiler release: $tag" | tee -a "$GITHUB_STEP_SUMMARY"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
build_on_windows:
name: Create/Upload Release Asset (Windows)
needs: compiler
runs-on: windows-2025-vs2026
env:
# A release package is flat, with the compiler and its libraries side by side.
TOOL_PATH: ${{ github.workspace }}\__tslang
GC_LIB_PATH: ${{ github.workspace }}\__tslang
LLVM_LIB_PATH: ${{ github.workspace }}\__tslang
TSLANG_LIB_PATH: ${{ github.workspace }}\__tslang
# the DLL build links Boehm from gc.dll (one collector per process)
GC_SHARED_LIB_PATH: ${{ github.workspace }}\__tslang\gcdll
# a release package ships only release-CRT libraries; see scripts\build_core.bat
TSLANG_DEBUG_CRT: /MT
steps:
- name: Checkout code
uses: actions/checkout@v4
# The package carries the default library of its own release. It goes, so nothing but the
# library built from this commit can be found.
- name: Download the compiler
shell: pwsh
env:
TAG: ${{ needs.compiler.outputs.tag }}
run: |
gh release download $env:TAG --repo $env:COMPILER_REPO --pattern 'tslang-*-windows-x64.zip' --output tslang.zip
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Expand-Archive -Path tslang.zip -DestinationPath $env:TOOL_PATH
Remove-Item tslang.zip
Remove-Item -Recurse -Force (Join-Path $env:TOOL_PATH 'defaultlib')
& (Join-Path $env:TOOL_PATH 'tslang.exe') --version
- name: Build the default library
shell: pwsh
run: |
$env:VSWHERE_PATH = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
.\build.bat
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Create Zip of Windows Asset
working-directory: ${{ github.workspace }}/__build
run: Get-ChildItem -Path .\* | Compress-Archive -DestinationPath ..\${{ env.ASSET_NAME }}-windows-x64.zip
shell: pwsh
- name: Archive Zip of Windows Asset
uses: actions/upload-artifact@v4
with:
name: defaultlib-windows-asset
path: ${{ env.ASSET_NAME }}-windows-x64.zip
retention-days: 1
build_on_linux:
name: Create/Upload Release Asset (${{ matrix.os }})
needs: compiler
# One package per Ubuntu release, as the compiler has: each is built with that release's compiler
# package and tools, so its binaries match that release's glibc and libstdc++.
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-26.04]
runs-on: ${{ matrix.os }}
env:
TOOL_PATH: ${{ github.workspace }}/__tslang
GC_LIB_PATH: ${{ github.workspace }}/__tslang
LLVM_LIB_PATH: ${{ github.workspace }}/__tslang
TSLANG_LIB_PATH: ${{ github.workspace }}/__tslang
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
shell: bash
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
# As on Windows: only the library built from this commit can be found.
- name: Download the compiler
shell: bash
env:
TAG: ${{ needs.compiler.outputs.tag }}
run: |
set -e
gh release download "$TAG" --repo "$COMPILER_REPO" --pattern 'tslang-*-${{ matrix.os }}-x64.tar.gz' --output tslang.tar.gz
mkdir -p "$TOOL_PATH"
tar -xzf tslang.tar.gz -C "$TOOL_PATH"
rm tslang.tar.gz
rm -rf "$TOOL_PATH/defaultlib"
"$TOOL_PATH/tslang" --version
- name: Build the default library
shell: bash
run: ./build.sh
- name: Create Tar.GZ of Linux Asset
working-directory: ${{ github.workspace }}/__build
shell: sh
run: tar -czhf ../${{ env.ASSET_NAME }}-${{ matrix.os }}-x64.tar.gz ./*
- name: Archive Tar.GZ of Linux Asset
uses: actions/upload-artifact@v4
with:
name: defaultlib-${{ matrix.os }}-asset
path: ${{ env.ASSET_NAME }}-${{ matrix.os }}-x64.tar.gz
retention-days: 1
create_release:
needs: [build_on_windows, build_on_linux]
# A manual run is on a branch, whose name is no release tag.
if: startsWith(github.ref, 'refs/tags/')
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: true
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
deploy_windows_asset:
needs: create_release
name: Upload Release (Windows)
runs-on: windows-latest
steps:
- name: Download Release Asset from Store
uses: actions/download-artifact@v4
with:
name: defaultlib-windows-asset
- name: Upload Release Asset (Windows)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ env.ASSET_NAME }}-windows-x64.zip
asset_name: ${{ env.ASSET_NAME }}-windows-x64.zip
asset_content_type: application/zip
deploy_linux_asset:
needs: create_release
name: Upload Release (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-26.04]
runs-on: ubuntu-latest
steps:
- name: Download Release Asset from Store
uses: actions/download-artifact@v4
with:
name: defaultlib-${{ matrix.os }}-asset
- name: Upload Release Asset (${{ matrix.os }})
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ env.ASSET_NAME }}-${{ matrix.os }}-x64.tar.gz
asset_name: ${{ env.ASSET_NAME }}-${{ matrix.os }}-x64.tar.gz
asset_content_type: application/tar+gzip