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
# - 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@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
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@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7 | |
with: | |
publish: pnpm ci:publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.TYPESCRIPT_BOT_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |