Scheduled Release #1529
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: Scheduled Release | |
| on: | |
| schedule: | |
| # Run every hour at minute 0 | |
| - cron: '0 * * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| check: | |
| name: Check for changesets | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| has_changesets: ${{ steps.check-changesets.outputs.has_changesets }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Check for changeset files | |
| id: check-changesets | |
| run: | | |
| # Count markdown files in .changeset folder excluding README.md | |
| changeset_count=$(find .changeset -name "*.md" -not -name "README.md" | wc -l) | |
| echo "Found $changeset_count changeset files" | |
| echo "has_changesets=$([[ $changeset_count -gt 0 ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| release: | |
| name: Create release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: check | |
| if: needs.check.outputs.has_changesets == 'true' | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install Dependencies | |
| run: | | |
| npm i | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: npm run ci:version | |
| publish: npm run ci:release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ORG_PAT }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} |