-
Notifications
You must be signed in to change notification settings - Fork 11
61 lines (51 loc) · 1.79 KB
/
patch.yml
File metadata and controls
61 lines (51 loc) · 1.79 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
# mongotools create patch from 'main' branch
name: patch
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20.x ]
steps:
- name: Check GitHub CLI
run: gh --version
- name: Checkout code
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
# version from package.json
run_install: false
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Patch
run: |
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global user.name 'github-actions[bot]'
git fetch --all
git checkout main
pnpm version patch
git branch -f npmjs
git push -f origin main npmjs --tags
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
run: |
# Extract version from package.json
VERSION=$(node -p "require('./package.json').version")
echo "🔖 Creating draft release for version v$VERSION"
# Optionally check if release already exists
if gh release view "v$VERSION" > /dev/null 2>&1; then
echo "::warning title=ℹ️ Release v$VERSION already exists, skipping."
else
gh release create "v$VERSION" --draft --generate-notes
echo "::notice title=✅ Draft release v$VERSION created."
fi