Skip to content

Commit b04eac1

Browse files
authored
test gh action (#7)
1 parent 5d83790 commit b04eac1

File tree

3 files changed

+51
-28
lines changed

3 files changed

+51
-28
lines changed

.github/workflows/npm-publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: NPM Publish
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
publish:
11+
# Only run if the PR was merged (not just closed) and has the version-bump label
12+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'version-bump')
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
ref: main # Ensure we're on main branch
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Install Bun
26+
uses: oven-sh/setup-bun@v1
27+
with:
28+
bun-version: latest
29+
30+
- name: Install dependencies
31+
run: bun install
32+
33+
- name: Run linting
34+
run: bun run lint
35+
36+
- name: Build
37+
run: bun run build
38+
39+
- name: Publish to NPM
40+
run: npm publish
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
name: Publish Package
1+
name: Version Bump
22

33
on:
44
push:
55
branches:
66
- main
77

88
jobs:
9-
publish:
9+
version-bump:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0 # Required for version bumping
15+
ssh-key: ${{ secrets.DEPLOY_KEY }} # Use deploy key to bypass branch protection
1516

1617
- name: Setup Git
1718
run: |
@@ -38,34 +39,14 @@ jobs:
3839
- name: Build
3940
run: bun run build
4041

41-
- name: Bump version and create PR
42+
- name: Bump version and push
4243
run: |
43-
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
44-
# Create a new branch for the version bump
45-
BRANCH_NAME="chore/bump-version-$(date +%s)"
46-
git checkout -b $BRANCH_NAME
44+
# Use SSH URL for the repository
45+
git remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git
4746
# Bump version
4847
npm version patch -m "chore: bump version to %s [skip ci]"
49-
# Push the new branch
50-
git push origin $BRANCH_NAME
51-
# Create PR using GitHub CLI
52-
gh pr create \
53-
--title "chore: bump version" \
54-
--body "Automated version bump" \
55-
--base main \
56-
--head $BRANCH_NAME
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
GITHUB_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
61-
- name: Setup GitHub CLI
62-
run: |
63-
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
64-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
65-
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
66-
&& 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 \
67-
&& sudo apt update \
68-
&& sudo apt install gh -y
48+
# Push directly to main
49+
git push origin HEAD:main --tags
6950
7051
- name: Publish to NPM
7152
run: npm publish

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onkernel/create-kernel-app",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "Create Kernel sample applications",
55
"main": "dist/index.js",
66
"type": "module",

0 commit comments

Comments
 (0)