Skip to content

Commit e54c93d

Browse files
committed
ci: add release step
1 parent 836ca01 commit e54c93d

3 files changed

Lines changed: 59 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Version bump type'
7+
required: true
8+
type: choice
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
id-token: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: pnpm/action-setup@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 24
26+
cache: pnpm
27+
registry-url: 'https://registry.npmjs.org'
28+
- run: pnpm install --frozen-lockfile
29+
- run: pnpm test
30+
- run: pnpm lint
31+
- run: pnpm format:check
32+
- run: pnpm build
33+
- name: Configure git
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
- name: Bump version
38+
run: npm version ${{ inputs.version }}
39+
- name: Push changes
40+
run: git push --follow-tags
41+
- name: Publish to npm
42+
run: npm publish
43+
- name: Create GitHub Release
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
VERSION=$(node -p "require('./package.json').version")
48+
gh release create "v$VERSION" --generate-notes

CONTRIBUTING.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ pnpm format:check
2929

3030
## Publishing (maintainers)
3131

32-
1. `npm version <major|minor|patch>`
33-
2. `pnpm build`
34-
3. `npm publish`
32+
1. Go to Actions → Release workflow
33+
2. Click "Run workflow"
34+
3. Select version type (patch/minor/major)
35+
36+
The workflow runs tests, bumps the version, publishes to npm (via OIDC trusted publishing), and creates a GitHub Release.
37+
38+
**Setup:** Configure trusted publishing at https://www.npmjs.com/package/loco-cli/settings by linking to GitHub Actions with workflow `release.yml`.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"version": "3.2.0",
44
"description": "CLI tool for syncing assets from and to Loco",
55
"license": "MIT",
6-
"repository": "robrechtme/loco-cli",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/robrechtme/loco-cli"
9+
},
710
"author": {
811
"name": "Robrecht Meersman",
912
"email": "hello@robrecht.me",

0 commit comments

Comments
 (0)