Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: NPM Publish

on:
pull_request:
types: [closed]
branches:
- main

jobs:
publish:
# Only run if the PR was merged (not just closed) and has the version-bump label
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'version-bump')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main # Ensure we're on main branch

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run linting
run: bun run lint

- name: Build
run: bun run build

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 changes: 8 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: Publish Package
name: Version Bump

on:
push:
branches:
- main

jobs:
publish:
version-bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for version bumping
ssh-key: ${{ secrets.DEPLOY_KEY }} # Use deploy key to bypass branch protection

- name: Setup Git
run: |
Expand All @@ -38,34 +39,14 @@ jobs:
- name: Build
run: bun run build

- name: Bump version and create PR
- name: Bump version and push
run: |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
# Create a new branch for the version bump
BRANCH_NAME="chore/bump-version-$(date +%s)"
git checkout -b $BRANCH_NAME
# Use SSH URL for the repository
git remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git
# Bump version
npm version patch -m "chore: bump version to %s [skip ci]"
# Push the new branch
git push origin $BRANCH_NAME
# Create PR using GitHub CLI
gh pr create \
--title "chore: bump version" \
--body "Automated version bump" \
--base main \
--head $BRANCH_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup GitHub CLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
# Push directly to main
git push origin HEAD:main --tags

- name: Publish to NPM
run: npm publish
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/create-kernel-app",
"version": "0.1.7",
"version": "0.1.8",
"description": "Create Kernel sample applications",
"main": "dist/index.js",
"type": "module",
Expand Down