-
-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (59 loc) · 1.9 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
name: Release + Publish
on:
workflow_dispatch:
inputs:
versionChange:
type: choice
description: Select the version change
required: true
options:
- major
- minor
- patch
jobs:
release:
runs-on: ubuntu-latest
env:
VERSION_CHANGE: ${{ github.event.inputs.versionChange }}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js ⚙️
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Install node_modules 📦
run: |
npm ci
- name: Update version ↗
run: |
git config --global user.name 'Philipp Kief'
git config --global user.email 'PKief@users.noreply.github.com'
git config --global push.followTags true
npm version ${{ env.VERSION_CHANGE }} -m "Release %s"
- name: Get meta data 🔍
run: |
NODE_VERSION=$(node -p -e "require('./package.json').version")
echo VERSION=$NODE_VERSION >> $GITHUB_ENV
NODE_NAME=$(node -p -e "require('./package.json').name")
echo NAME=$NODE_NAME >> $GITHUB_ENV
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName")
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV
- name: Build ⚒️
run: npm run build
- name: Push tags 📌
run: git push
- name: Release ${{ env.VERSION }} 🔆
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }}
generate_release_notes: true
- name: Publish to NPM Registry 🚀
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}