-
Notifications
You must be signed in to change notification settings - Fork 578
v1.2.0 #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
v1.2.0 #259
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| name: NPX Package Publish | ||
|
|
||
| # Triggers when npx package is tagged | ||
| on: | ||
| push: | ||
| tags: | ||
| - "npx/v*" | ||
|
|
||
| # Prevent concurrent runs for the same trigger | ||
| concurrency: | ||
| group: npx-publish-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| id-token: write # Required for npm provenance | ||
| steps: | ||
| # Checkout the repository | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Set up Node.js environment | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache: "npm" | ||
| cache-dependency-path: | | ||
| npx/package-lock.json | ||
|
|
||
| # Extract and validate version from tag | ||
| - name: Extract version from tag | ||
| id: extract-version | ||
| run: ./.github/workflows/scripts/extract-npx-version.sh | ||
|
|
||
|
akshaydeo marked this conversation as resolved.
|
||
| # Update package.json with the tagged version | ||
| - name: Update package version | ||
| working-directory: npx | ||
| run: | | ||
| VERSION="${{ steps.extract-version.outputs.version }}" | ||
| echo "📝 Updating package.json version to $VERSION" | ||
| npm version "$VERSION" --no-git-tag-version | ||
|
|
||
| # Install dependencies (if any) | ||
| - name: Install dependencies | ||
| working-directory: npx | ||
| run: npm ci | ||
|
|
||
| # Run tests (if any exist) | ||
| - name: Run tests | ||
| working-directory: npx | ||
| run: | | ||
| if [ -f "package.json" ] && npm run | grep -q "test"; then | ||
| echo "🧪 Running tests..." | ||
| npm test | ||
| else | ||
| echo "⏭️ No tests found, skipping..." | ||
| fi | ||
|
|
||
|
akshaydeo marked this conversation as resolved.
|
||
| # Publish to npm | ||
| - name: Publish to npm | ||
| working-directory: npx | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| run: | | ||
| VERSION="${{ steps.extract-version.outputs.version }}" | ||
| echo "📦 Publishing @maximhq/bifrost@${VERSION} to npm..." | ||
| if npm view @maximhq/bifrost@"${VERSION}" version >/dev/null 2>&1; then | ||
| echo "ℹ️ @maximhq/bifrost@${VERSION} already exists on npm. Skipping publish." | ||
| else | ||
| npm publish --provenance --access public | ||
| fi | ||
|
akshaydeo marked this conversation as resolved.
|
||
|
|
||
|
akshaydeo marked this conversation as resolved.
|
||
| # Create GitHub release | ||
| - name: Create GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| run: bash .github/workflows/scripts/create-npx-release.sh "${{ steps.extract-version.outputs.version }}" "${{ steps.extract-version.outputs.full-tag }}" | ||
|
|
||
| # Discord notification | ||
| - name: Discord Notification | ||
| if: always() | ||
| env: | ||
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
| run: | | ||
| AUTHOR="${{ github.actor }}" | ||
| COMMIT_AUTHOR="$(git log -1 --pretty=%an || true)" | ||
| if [ -n "$COMMIT_AUTHOR" ]; then AUTHOR="$COMMIT_AUTHOR"; fi | ||
| if [ "${{ job.status }}" = "success" ]; then | ||
| TITLE="📦 **NPX Package Published**" | ||
| STATUS="✅ Success" | ||
| VERSION_LINE="**Version**: \`${{ steps.extract-version.outputs.version }}\`" | ||
| PACKAGE_LINE="**Package**: \`@maximhq/bifrost\`" | ||
| NPM_LINK="**[View on npm](https://www.npmjs.com/package/@maximhq/bifrost)**" | ||
| MESSAGE="$TITLE\n**Status**: $STATUS\n$VERSION_LINE\n$PACKAGE_LINE\n$NPM_LINK\n**Tag**: \`${{ steps.extract-version.outputs.full-tag }}\`\n**Commit**: \`${{ github.sha }}\`\n**Author**: ${AUTHOR}\n**[View Workflow Run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})**" | ||
| else | ||
| TITLE="📦 **NPX Package Publish Failed**" | ||
| STATUS="❌ Failed" | ||
| MESSAGE="$TITLE\n**Status**: $STATUS\n**Tag**: \`${{ steps.extract-version.outputs.full-tag }}\`\n**Commit**: \`${{ github.sha }}\`\n**Author**: ${AUTHOR}\n**[View Workflow Run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})**" | ||
| fi | ||
| payload="$(jq -n --arg content "$MESSAGE" '{content:$content}')" | ||
| curl -sS -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.