Merge pull request #4 from PolicyEngine/demo-site #1
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: Version, Changelog, and Publish | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| release: | |
| name: Bump version, build changelog, publish to npm | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, 'Release @policyengine/ui-kit')" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.POLICYENGINE_GITHUB }} | |
| - name: Check for changelog fragments | |
| id: check | |
| run: | | |
| FRAGMENTS=$(ls changelog.d/ | grep -v .gitkeep | wc -l) | |
| echo "count=$FRAGMENTS" >> "$GITHUB_OUTPUT" | |
| - name: Bump version | |
| if: steps.check.outputs.count != '0' | |
| run: python .github/bump_version.py | |
| - name: Build changelog | |
| if: steps.check.outputs.count != '0' | |
| run: python .github/build_changelog.py | |
| - name: Set up Bun | |
| if: steps.check.outputs.count != '0' | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| if: steps.check.outputs.count != '0' | |
| run: bun install --frozen-lockfile | |
| - name: Build | |
| if: steps.check.outputs.count != '0' | |
| run: bun run build | |
| - name: Set up Node for npm publish | |
| if: steps.check.outputs.count != '0' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish to npm | |
| if: steps.check.outputs.count != '0' | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Commit and push | |
| if: steps.check.outputs.count != '0' | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: "Release @policyengine/ui-kit" | |
| default_author: github_actions | |
| add: | | |
| package.json | |
| CHANGELOG.md | |
| changelog.d/ |