-
Notifications
You must be signed in to change notification settings - Fork 765
83 lines (72 loc) · 2.63 KB
/
Copy pathrelease.yml
File metadata and controls
83 lines (72 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
registry-url: 'https://registry.npmjs.org'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Bump version
id: bump_version
run: |
# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"
# Bump version using npm version
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version: $NEW_VERSION"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Sync workspace versions
run: node scripts/set-version.mjs "${{ steps.bump_version.outputs.new_version }}"
- name: Commit changes and tag
run: |
git add package.json packages/kode-bin-*/package.json packages/kode-ripgrep-*/package.json
git commit -m "Release v${{ steps.bump_version.outputs.new_version }}"
git tag -a v${{ steps.bump_version.outputs.new_version }} -m "Release v${{ steps.bump_version.outputs.new_version }}"
git push origin HEAD:main
git push origin --tags
echo "✅ Tag pushed: v${{ steps.bump_version.outputs.new_version }}"
- name: Dispatch stable release workflow
uses: actions/github-script@v7
with:
script: |
const tag = `v${{ steps.bump_version.outputs.new_version }}`
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'npm-publish.yml',
ref: tag,
})
core.info(`Dispatched npm-publish.yml for ${tag}`)