diff --git a/.github/workflows/set-version.yaml b/.github/workflows/set-version.yaml new file mode 100644 index 00000000000..1119931e13e --- /dev/null +++ b/.github/workflows/set-version.yaml @@ -0,0 +1,45 @@ +name: Set branch version + +on: + repository_dispatch: + types: set-version + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Use node version 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.client_payload.branch_name }} + fetch-depth: 0 + # 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 = .*;/const version = "${{ github.event.client_payload.package_version }}";/g' src/compiler/corePublic.ts + npm install + gulp 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 ./lib + git config user.email "ts_bot@rcavanaugh.com" + git config user.name "TypeScript Bot" + git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' + git push