This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build a version of TypeScript on request | |
on: | |
repository_dispatch: | |
# This workflow is triggered from an API call where XXX is your token | |
# and YYY is the PR that it should look at. | |
# curl https://api.github.com/repos/microsoft/typescript-make-monaco-builds/dispatches \ | |
# -XPOST \ | |
# -H 'Content-Type: application/json' \ | |
# -H 'Accept: application/vnd.github.everest-preview+json' \ | |
# -H "Authorization: token XXX" \ | |
# --data-binary '{ "event_type": "YYY" }' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: blob-storage | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
registry-url: "https://registry.npmjs.org" | |
# Lets us use one-liner JSON manipulations on package.jsons | |
- run: "npm install -g json" | |
- name: Publish PR Build | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
run: | | |
yarn install | |
PULL_REQUEST_NUMBER=$(json -f $GITHUB_EVENT_PATH action) | |
echo "Publishing Monaco based on $PULL_REQUEST_NUMBER" | |
ZIP_FILE=$(node pulls/echo-typescript-url.js $PULL_REQUEST_NUMBER) | |
echo "Using zip file from:" | |
echo $ZIP_FILE | |
SEMVER_NUMBER=$(node pulls/echo-release-version.js $PULL_REQUEST_NUMBER) | |
echo "Re-publishing TypeScript tarball to npm" | |
node ./pulls/republish-typescript-tarball.js $ZIP_FILE $SEMVER_NUMBER | |
echo "Building TS Monaco $SEMVER_NUMBER" | |
echo "Building Monaco Editor with the new TS Monaco" | |
node ./publish-monaco-editor.js $SEMVER_NUMBER @typescript-deploys/pr-build | |
echo "" | |
echo "" | |
echo "" | |
echo "https://www.typescriptlang.org/play/?ts=$SEMVER_NUMBER" | |
echo "" | |
echo "" | |
echo "" | |
echo "Commenting back on the PR" | |
node pulls/comment-on-release.js $PULL_REQUEST_NUMBER $SEMVER_NUMBER | |
- name: 'Az CLI login' | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Upload to Azure | |
env: | |
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }} | |
run: node ./upload-assets-to-blob-storage.js |