chore(deps-dev): bump svelte from 5.49.2 to 5.51.3 #201
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: Test, Publish and Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| id-token: write | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build project | |
| run: bun run build | |
| - name: Run tests | |
| run: bun run test | |
| publish: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Get current version | |
| id: current_version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Current version: $VERSION" | |
| - name: Detect prerelease tag | |
| id: prerelease_tag | |
| run: | | |
| VERSION="${{ steps.current_version.outputs.version }}" | |
| # Check if version contains a prerelease identifier (e.g., -alpha, -beta, -rc) | |
| if [[ "$VERSION" =~ -([a-zA-Z]+)\. ]]; then | |
| TAG="${BASH_REMATCH[1]}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "is_prerelease=true" >> $GITHUB_OUTPUT | |
| echo "📦 Detected prerelease version: $VERSION → dist-tag: $TAG" | |
| else | |
| echo "tag=latest" >> $GITHUB_OUTPUT | |
| echo "is_prerelease=false" >> $GITHUB_OUTPUT | |
| echo "📦 Stable version: $VERSION → dist-tag: latest" | |
| fi | |
| - name: Check if version is published | |
| id: check_published | |
| run: | | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| VERSION="${{ steps.current_version.outputs.version }}" | |
| if npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null; then | |
| echo "published=true" >> $GITHUB_OUTPUT | |
| echo "📦 Version $VERSION is already published to npm" | |
| else | |
| echo "published=false" >> $GITHUB_OUTPUT | |
| echo "✨ Version $VERSION is not published yet" | |
| fi | |
| - name: Install dependencies | |
| if: steps.check_published.outputs.published == 'false' | |
| run: bun install | |
| - name: Build package | |
| if: steps.check_published.outputs.published == 'false' | |
| run: bun run prepack | |
| - name: Publish to NPM | |
| if: steps.check_published.outputs.published == 'false' | |
| run: npm publish --provenance --access public --tag ${{ steps.prerelease_tag.outputs.tag }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Skip publishing | |
| if: steps.check_published.outputs.published == 'true' | |
| run: | | |
| echo "⏭️ Skipping npm publish - version ${{ steps.current_version.outputs.version }} already published" | |
| outputs: | |
| version: ${{ steps.current_version.outputs.version }} | |
| should_release: ${{ steps.check_published.outputs.published == 'false' }} | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: publish | |
| if: needs.publish.outputs.should_release == 'true' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Create and push tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "v${{ needs.publish.outputs.version }}" -m "Release v${{ needs.publish.outputs.version }}" | |
| git push origin "v${{ needs.publish.outputs.version }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate changelog and create release | |
| run: npx changelogithub | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |