release.yml fomated and linted #10
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: | |
| 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 | |
| # ------------------------------ | |
| # Yarn Dependency Cache | |
| # ------------------------------ | |
| - name: Cache Yarn dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/yarn | |
| node_modules | |
| libs/**/node_modules | |
| key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: | | |
| yarn-${{ runner.os }}- | |
| # ------------------------------ | |
| # 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 (correct) | |
| # ------------------------------ | |
| - 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 }} |