chore(ci): automatic release notes generation #4
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 shalecss to NPM | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "lts/*" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Build packages | |
| run: npm run build | |
| - name: Publish @shalecss/core | |
| run: npm publish --workspace=@shalecss/core --access public --provenance | |
| - name: Publish @shalecss/react | |
| run: npm publish --workspace=@shalecss/react --access public --provenance | |
| - name: Generate release notes | |
| run: | | |
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD) | |
| REPO_URL="https://github.com/logonoff/shalecss" | |
| for workspace in core react; do | |
| echo "## \`@shalecss/${workspace}\`:" | |
| commits=$(git log --format="- %h %s" "${PREV_TAG}..HEAD" -- "workspaces/${workspace}/") | |
| if [ -z "$commits" ]; then | |
| echo "- No changes" | |
| else | |
| echo "$commits" | |
| fi | |
| echo "" | |
| done > notes.md | |
| echo "**Full Changelog**: ${REPO_URL}/compare/${PREV_TAG}...${{ github.ref_name }}" >> notes.md | |
| - name: Create GitHub release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tag="${GITHUB_REF#refs/tags/}" | |
| gh release create "$tag" \ | |
| --title="$tag" \ | |
| --notes-file notes.md |