-
Notifications
You must be signed in to change notification settings - Fork 10
54 lines (52 loc) · 1.8 KB
/
generate-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
---
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#######################################
# Start the job on all push to master #
#######################################
name: Generate a Release
on:
workflow_dispatch:
###############
# Set the Job #
###############
jobs:
# Deploy to NPM
deploy_to_npm:
name: Generate a Release Version and Commit to Repo
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PATX }}
# Setup .npmrc file to publish to npm
- uses: actions/[email protected]
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
scope: rubenhalman
- name: Generate New Release Number
id: generate-release-number
run: |
npm install -g semver
export OLD_VER=$(semver --coerce $(cat package.json | jq .version))
export NEW_VER=$(semver --coerce $(cat package.json | jq .version) --increment minor)
echo "NEW_VER=$(echo $NEW_VER)" >> "$GITHUB_OUTPUT"
- name: Install dependencies
run: |
export NEW_VER=${{ steps.generate-release-number.outputs.NEW_VER }}
cat package.json | jq --arg NEW_VER "$NEW_VER" '.version = $NEW_VER' package.json
npm install
git config --global user.name ${{ vars.USER_NAME }}
git config --global user.email ${{ vars.USER_EMAIL }}
git add .
git commit -m "chore(release): ${{ steps.generate-release-number.outputs.NEW_VER }} [skip ci]" --no-verify
git push origin master
git tag v${{ steps.generate-release-number.outputs.NEW_VER }}
git push --tags
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKENX }}