File: set-version.yaml

package info (click to toggle)
node-typescript 5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 497,488 kB
  • sloc: javascript: 2,107,274; makefile: 6; sh: 1
file content (58 lines) | stat: -rw-r--r-- 2,719 bytes parent folder | download
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
name: Set branch version

on:
  repository_dispatch:
    types: set-version

permissions:
  contents: read

# Ensure scripts are run with pipefail. See:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
defaults:
  run:
    shell: bash

jobs:
  build:
    runs-on: ubuntu-latest

    permissions:
      contents: write

    steps:
    - uses: actions/setup-node@v3
    - uses: actions/checkout@v3
      with:
        ref: ${{ github.event.client_payload.branch_name }}
    - run: |
        npm --version
        # corepack enable npm
        npm install -g $(jq -r '.packageManager' < package.json)
        npm --version
    # notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists
    # do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the
    # `version` identifier no longer match the regex it uses
    # required client_payload members:
    # branch_name - the target branch
    # package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`)
    # core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`)
    - run: |
        sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
        sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
        sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
        sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
        sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
        npm ci
        npx hereby LKG
        npm test
        git diff
        git add package.json
        git add src/compiler/corePublic.ts
        git add tests/baselines/reference/api/typescript.d.ts
        git add tests/baselines/reference/api/tsserverlibrary.d.ts
        git add --force ./lib
        git config user.email "typescriptbot@microsoft.com"
        git config user.name "TypeScript Bot"
        git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'
        git push