Schedule Build #57
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: Schedule Build | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| permissions: write-all | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: index.d.ts size | |
| run: | | |
| echo "prev=$(wc -c src/index.d.ts | awk '{print $1}')" >> $GITHUB_OUTPUT | |
| id: prev-size | |
| - run: bun i | |
| - run: bun test --coverage | |
| - run: bun lint | |
| - run: bun run build | |
| - name: index.d.ts size | |
| run: | | |
| echo "new=$(wc -c src/index.d.ts | awk '{print $1}')" >> $GITHUB_OUTPUT | |
| id: new-size | |
| - name: Update Package | |
| if: steps.new-size.outputs.new != steps.prev-size.outputs.prev | |
| run: | | |
| bunx @changepacks/cli -y --update-type patch -m "chore: update package version" | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "github-actions[bot]" | |
| git add . | |
| git commit -m "chore: update package version" | |
| git push | |
| # Create pr | |
| - uses: changepacks/action@main | |
| if: steps.new-size.outputs.new != steps.prev-size.outputs.prev | |
| - name: Merge PR | |
| if: steps.new-size.outputs.new != steps.prev-size.outputs.prev | |
| run: | | |
| PR_NUMBER=$(gh pr list --head changepacks/main --base main --json number --jq '.[0].number') | |
| if [ -n "$PR_NUMBER" ]; then | |
| gh pr merge $PR_NUMBER --merge --delete-branch | |
| else | |
| echo "No PR found for changepacks/main branch" | |
| exit 1 | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| # Publish Package | |
| - uses: changepacks/action@main | |
| if: steps.new-size.outputs.new != steps.prev-size.outputs.prev | |
| - run: bun publish --access public --ignore-scripts | |
| if: steps.new-size.outputs.new != steps.prev-size.outputs.prev | |
| env: | |
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} |