Skip to content

Auto Merge Upstream and Publish Operators #66

Auto Merge Upstream and Publish Operators

Auto Merge Upstream and Publish Operators #66

name: Auto Merge Upstream and Publish Operators
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'
jobs:
merge-build-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up git and fetch branches
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote add upstream https://github.com/microsoft/TypeScript.git || true
git fetch upstream
git fetch origin operators
- name: Merge upstream/main into main
run: |
git checkout main
git merge upstream/main
- name: Push merged changes to main
run: git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/adrianstephens/TypeScript.git HEAD:main
- name: Merge operators into main
run: git merge origin/operators
- name: Push merged changes to operators
run: git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/adrianstephens/TypeScript.git HEAD:operators
- name: Checkout operators branch
run: git checkout operators
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run LKG build
run: npx hereby LKG
- name: Publish to npm
if: success()
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm publish --access public