deps-dev(deps-dev): bump semantic-release in the dev-dependencies gro… #28
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: | |
| branches: | |
| - main | |
| - develop | |
| - alpha | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| packages: write | |
| jobs: | |
| test: | |
| name: Test on Node.js ${{ matrix.node-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x, 22.x] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint | |
| continue-on-error: true | |
| - name: Build | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| release: | |
| name: Release | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Configure npm for GitHub Packages | |
| run: | | |
| echo "@wyre-technology:registry=https://npm.pkg.github.com" >> .npmrc | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx semantic-release | |
| - name: Get released version | |
| id: release-version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| if gh release view "v$VERSION" --repo ${{ github.repository }} &>/dev/null; then | |
| echo "released=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "released=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Discord release notification | |
| if: steps.release-version.outputs.released == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| run: | | |
| VERSION="${{ steps.release-version.outputs.version }}" | |
| BODY=$(gh release view "v$VERSION" --json body --jq '.body' 2>/dev/null || echo "") | |
| SUMMARY=$(echo "$BODY" | sed '1,2d' | head -30 | cut -c1-1800) | |
| PAYLOAD=$(jq -n \ | |
| --arg title "New Release: v$VERSION" \ | |
| --arg desc "**${{ github.repository }}** — [v$VERSION](https://github.com/${{ github.repository }}/releases/tag/v$VERSION) | |
| $SUMMARY" \ | |
| '{embeds: [{title: $title, description: $desc, color: 5763847}]}') | |
| curl -sf -H "Content-Type: application/json" -d "$PAYLOAD" "$DISCORD_WEBHOOK" |