Merge pull request #29 from United-Way-of-Greater-Cincinnati/swagger-… #9
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: Semantic Release | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build and test | |
| run: | | |
| npm run build | |
| npm run test:type-check | |
| npm run test:ci | |
| - name: Build package | |
| run: ./package.sh | |
| - name: Semantic Release (with npm lifecycle) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm run release | |
| - name: Commit and push workflow mutations (if any) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| # Stage docs and common release-mutation files to avoid failing on dirty tree | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A \ | |
| package.json \ | |
| package-lock.json \ | |
| package/package.json \ | |
| CHANGELOG.md || true | |
| # If nothing is staged, skip committing to avoid exit 1 from git commit | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| LAST_TAG=$(git describe --tags --abbrev=0 || echo "latest") | |
| git commit -m "chore(ci): commit workflow mutations (version bumps, lockfile) for ${LAST_TAG} [skip ci]" | |
| git push origin HEAD:${GITHUB_REF_NAME} |