Skip to content
# - changesets will open a PR to bump versions when new changesets are added
# - changesets will publish packages when that PR is merged
# (it's confusing because the same action does two super different things)
name: Format, Version or Publish Packages
on:
workflow_dispatch:
push:
branches:
- main
permissions:
pull-requests: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
token: ${{ secrets.TYPESCRIPT_BOT_TOKEN }}
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 20
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- run: pnpm config set store-dir $PNPM_CACHE_FOLDER
- run: pnpm install
- run: pnpm build
- run: pnpm test
- name: format
run: |
pnpm format
if [ -n "`git status -s`" ]; then
git config user.email "[email protected]"
git config user.name "TypeScript Bot"
git commit -am "Format"
git push
fi
- uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9
with:
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.TYPESCRIPT_BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}