Version Packages (#1102) #365
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@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
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 }} |