-
Notifications
You must be signed in to change notification settings - Fork 113
39 lines (39 loc) · 1.45 KB
/
version.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
name: version
on:
workflow_dispatch:
jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set Git user
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Set variables
run: |
echo "CURRENT_VERSION=$(jq -r .version lerna.json)" >> $GITHUB_ENV
echo "LAST_MINOR=$((npm --silent info ern-core version || echo '0.0.0') | cut -d '.' -f 2)" >> $GITHUB_ENV
- run: yarn --frozen-lockfile
- name: Minor version
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
run: |
git checkout -b v0.$((LAST_MINOR+1))
git push -u origin v0.$((LAST_MINOR+1))
yarn lerna version 0.$((LAST_MINOR+1)).0 -y --exact --force-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Patch version
if: startsWith(env.CURRENT_VERSION, '0.')
run: yarn lerna version patch -y --exact --force-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: echo "VERSION=$(jq -r .version lerna.json)" >> $GITHUB_ENV
- run: gh release create v$VERSION -d --generate-notes -t $VERSION
env:
GH_TOKEN: ${{ github.token }}