Add allowCleaning option, rename option to updateCodeRanges (#5)
#11
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| release: | |
| name: Release | |
| if: github.repository_owner == 'expressive-code' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Setup PNPM | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check for unreleased changesets | |
| id: has-changesets | |
| uses: andstor/file-existence-action@v2 | |
| with: | |
| files: ".changeset/!(README).md" | |
| # If there are unreleased changesets, validate the project before creating the changesets PR | |
| - name: Require build, test and lint to pass | |
| if: steps.has-changesets.outputs.files_exists == 'true' | |
| run: | | |
| pnpm build | |
| pnpm test | |
| pnpm lint | |
| # Run changesets action either if there are unreleased changesets (= a PR must be created) | |
| # or if the commit message matches the release PR (= new versions must be published to NPM) | |
| - name: Create changesets PR or publish to NPM | |
| id: changesets | |
| if: steps.has-changesets.outputs.files_exists == 'true' || startsWith(github.event.head_commit.message, '[CI] Release') | |
| uses: changesets/action@v1 | |
| with: | |
| title: '[CI] Release' | |
| commit: '[CI] Release' | |
| version: 'pnpm ci-version' | |
| publish: 'pnpm ci-publish' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |