-
-
Notifications
You must be signed in to change notification settings - Fork 137
65 lines (54 loc) · 1.61 KB
/
release.yml
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
name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (major/minor/patch)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: https://registry.npmjs.org/
- name: Git config
run: |
git config --local user.email "github-actions@github.com"
git config --local user.name "github-actions"
- name: Install dependencies
run: npm ci
- name: Merge dev into main
run: |
git checkout main
git merge origin/dev
- name: Create Release
run: npm run release:${{ github.event.inputs.release-type }}
- name: Update package-lock.json
run: npm install
- name: Commit package-lock.json if changed
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ -n "$(git status --porcelain package-lock.json)" ]]; then
git add package-lock.json
git commit -m "chore: bump version to ${VERSION}"
fi
- name: Push changes
run: |
git push --follow-tags origin main
git checkout dev
git merge main
git push origin dev