-
Notifications
You must be signed in to change notification settings - Fork 187
74 lines (65 loc) · 2.12 KB
/
createRelease.yml
File metadata and controls
74 lines (65 loc) · 2.12 KB
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
66
67
68
69
70
71
72
73
74
name: Create release and tag
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
release-type: # id of input
description: "prerelease, patch, minor or major"
required: true
default: "prerelease"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
release-type: ${{ github.event.inputs.release-type }}
jobs:
build:
name: "Creating changelog and release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: generate tag and release body
run: |
RELEASE_TYPE=$(sh ${{ github.workspace }}/.github/workflows/getReleaseType.sh ${{ env.release-type }})
git config user.name github-ljprojectbuilder
git config user.email code@starwit.de
npx standard-version -i CHANGELOG.md --release-as $RELEASE_TYPE --tag-prefix=''
- name: Read CHANGELOG.md
id: package
uses: juliangruber/read-file-action@v1
with:
path: ./CHANGELOG.md
- name: Echo CHANGELOG.md
run: echo '${{ steps.package.outputs.content }}'
- name: publish tag
id: publish_tag
run: |
git push --follow-tags
echo ::set-output name=tag_name::$(git describe HEAD --abbrev=0)
- name: create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: Release ${{ steps.publish_tag.outputs.tag_name }}
tag_name: ${{ steps.publish_tag.outputs.tag_name }}
body_path: CHANGELOG.md
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: npm install
run: |
npm install
npm run build
- name: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: package.json
- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"