0.1.7 #8
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*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| TAG=${{ github.ref_name }} | |
| VERSION=${TAG#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Update package version | |
| run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version | |
| --allow-same-version | |
| - name: Update CHANGELOG.md | |
| run: | | |
| VERSION=${{ steps.version.outputs.version }} | |
| TAG=${{ steps.version.outputs.tag }} | |
| DATE=$(date +%Y-%m-%d) | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || true) | |
| { | |
| head -n 3 CHANGELOG.md | |
| printf '\n## v%s - %s\n\n' "$VERSION" "$DATE" | |
| if [ -n "$PREVIOUS_TAG" ]; then | |
| git log --reverse --no-merges --pretty=format:'- %s (%h)' "${PREVIOUS_TAG}..${TAG}" | |
| else | |
| git log --reverse --no-merges --pretty=format:'- %s (%h)' "${TAG}" | |
| fi | |
| printf '\n\n' | |
| tail -n +4 CHANGELOG.md | |
| } > CHANGELOG.new.md | |
| mv CHANGELOG.new.md CHANGELOG.md | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Format code and changelog | |
| run: npm run format | |
| - name: Commit release metadata update | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add CHANGELOG.md package.json package-lock.json | |
| git commit -m "chore(release): sync metadata for v${{ steps.version.outputs.version }}" --allow-empty | |
| - name: Build | |
| env: | |
| VITE_APP_VERSION: ${{ steps.version.outputs.version }} | |
| run: npm run build | |
| - name: Push changelog update | |
| run: | | |
| git push origin HEAD:${{ github.event.repository.default_branch }} | |
| - name: Archive dist | |
| run: tar -czf markdown-live-dist-${{ steps.version.outputs.tag }}.tar.gz dist | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: markdown-live-dist-${{ steps.version.outputs.tag }}.tar.gz |