-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (57 loc) · 1.84 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
name: Release
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type (one of): patch, minor, major'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ env.HEXANCORE_BOT_TOKEN }}
env:
HEXANCORE_BOT_TOKEN: ${{ secrets.HEXANCORE_BOT_TOKEN }}
- name: Yarn install
uses: hexancore/yarn-ci-install@0.1.0
- name: test
uses: ./.github/actions/test
# Bump version
- name: Bump package version
run: |
yarn version $RELEASE_TYPE
echo "RELEASE_TAG=latest" >> $GITHUB_ENV
echo "NEW_VERSION=$(jq -r '.version' < package.json)" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ inputs.releaseType }}
# Publish package
- name: Publish
run: |
echo -e "\nnpmAuthToken: '${{ env.NODE_AUTH_TOKEN }}'" >> ./.yarnrc.yml
yarn npm publish --access public --tag ${{ env.RELEASE_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update CHANGELOG.md
uses: 'zen8sol/update-changelog-action@0.1.5'
with:
newVersion: '${{ env.NEW_VERSION }}'
# Commit
- name: Commit CHANGELOG.md and package.json changes and create tag
run: |
git config --global user.email "153127894+hexancore-bot@users.noreply.github.com"
git config --global user.name "Hexancore Bot"
git add "package.json"
git add "CHANGELOG.md"
git commit -m "chore: release ${{ env.NEW_VERSION }}"
git tag -m 'new version' ${{ env.NEW_VERSION }}
git push --follow-tags