chore(ci): fix git-cliff installation and finalize release workflow #7
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: | |
| build-and-release: | |
| name: Build & Publish Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| # ------------------------------ | |
| # Checkout | |
| # ------------------------------ | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # ------------------------------ | |
| # Node Setup | |
| # ------------------------------ | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| # ------------------------------ | |
| # Install Dependencies | |
| # ------------------------------ | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| # ------------------------------ | |
| # Code Quality Checks | |
| # ------------------------------ | |
| - name: Lint code | |
| run: yarn lint --max-warnings=0 | |
| - name: Check formatting | |
| run: yarn prettier --check . | |
| - name: Type check | |
| run: yarn tsc --noEmit | |
| # ------------------------------ | |
| # Build | |
| # ------------------------------ | |
| - name: Build project | |
| run: yarn build | |
| # ------------------------------ | |
| # Install git-cliff (LATEST release, correct filter) | |
| # ------------------------------ | |
| - name: Install git-cliff | |
| run: | | |
| LATEST=$(curl -s https://api.github.com/repos/orhun/git-cliff/releases/latest \ | |
| | jq -r '.assets[] | select(.name | test("x86_64-unknown-linux-musl.tar.gz$")) | .browser_download_url') | |
| echo "Downloading: $LATEST" | |
| curl -sSL "$LATEST" -o git-cliff.tar.gz | |
| tar -xzf git-cliff.tar.gz | |
| sudo mv git-cliff*/git-cliff /usr/local/bin/git-cliff | |
| # ------------------------------ | |
| # Generate Changelog | |
| # ------------------------------ | |
| - name: Generate changelog | |
| run: | | |
| git-cliff --tag ${GITHUB_REF#refs/tags/} > RELEASE_CHANGELOG.md | |
| echo "Generated changelog:" | |
| cat RELEASE_CHANGELOG.md | |
| # ------------------------------ | |
| # Package Release Files | |
| # ------------------------------ | |
| - name: Archive build output | |
| run: | | |
| mkdir -p release | |
| cp -r dist release/ | |
| cp package.json release/ | |
| cp yarn.lock release/ | |
| cp RELEASE_CHANGELOG.md release/ | |
| # ------------------------------ | |
| # Publish GitHub Release | |
| # ------------------------------ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: RELEASE_CHANGELOG.md | |
| files: | | |
| release/** | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |