This repository was archived by the owner on Apr 28, 2026. It is now read-only.
chore(release): v0.2.2 #15
Workflow file for this run
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: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: ci | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: "https://registry.npmjs.org" | |
| - run: npm i -g npm@latest | |
| - run: npm ci | |
| - run: npm test | |
| - run: npm run build | |
| - run: npm publish --access public --provenance | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| - name: Get previous release date | |
| id: prev | |
| run: | | |
| prev=$(gh release list -R ${{ github.repository }} --limit 2 \ | |
| --json tagName,publishedAt -q '.[1].publishedAt // empty') | |
| echo "date=${prev:-$(date -d '-30 days' -Idate)}" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate changelog | |
| run: | | |
| end_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| response=$(curl -sf -X POST "${{ secrets.CHANGELOG_API_URL }}/api/v1/changelog" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "owner": "${{ github.repository_owner }}", | |
| "repo": "${{ github.event.repository.name }}", | |
| "startDate": "${{ steps.prev.outputs.date }}", | |
| "endDate": "'"$end_date"'", | |
| "style": "end-user", | |
| "webhookUrl": "${{ secrets.WEBHOOK_URL }}" | |
| }') | |
| echo "$response" | jq -r '.changelog' > changelog.md | |
| echo "Generated changelog for ${{ github.ref_name }}" | |
| - name: Update release notes | |
| run: | | |
| gh release edit ${{ github.ref_name }} \ | |
| -R ${{ github.repository }} \ | |
| --notes-file changelog.md | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |