Skip to content

Commit f80c0c1

Browse files
committed
Add set-version workflow
1 parent 4d1a1b8 commit f80c0c1

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/set-version.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Set branch version
2+
3+
on:
4+
repository_dispatch:
5+
types: set-version
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Use node version 12.x
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 12.x
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.client_payload.branch_name }}
19+
fetch-depth: 0
20+
# notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists
21+
# do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the
22+
# `version` identifier no longer match the regex it uses
23+
# required client_payload members:
24+
# branch_name - the target branch
25+
# package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`)
26+
# core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`)
27+
- run: |
28+
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
29+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
30+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
31+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
32+
sed -i -e 's/const version = .*;/const version = "${{ github.event.client_payload.package_version }}";/g' src/compiler/corePublic.ts
33+
npm install
34+
gulp LKG
35+
npm test
36+
git diff
37+
git add package.json
38+
git add src/compiler/corePublic.ts
39+
git add tests/baselines/reference/api/typescript.d.ts
40+
git add tests/baselines/reference/api/tsserverlibrary.d.ts
41+
git add ./lib
42+
git config user.email "[email protected]"
43+
git config user.name "TypeScript Bot"
44+
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'
45+
git push

0 commit comments

Comments
 (0)