generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 25
54 lines (48 loc) · 1.77 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
name: "Release Workflow"
on:
push:
branches:
- 'releases/v1.6'
- 'releases/v2.3'
- 'releases/v3.3.0'
- 'main'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: read versions
id: read-version
run: |
echo "version=$(jq -r ".version" package.json)" >> $GITHUB_OUTPUT
echo "tag=v$(jq -r ".version" package.json)" >> $GITHUB_OUTPUT
echo "major_tag=v$(jq -r ".version" package.json | cut -d '.' -f 1)" >> $GITHUB_OUTPUT
- name: read changelog entry for version
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: "${{ steps.read-version.outputs.tag }}"
path: ./CHANGELOG.md
- name: check for existing release
id: check_release
run: |
TAG=$(git ls-remote --tags origin | grep ${{ steps.read-version.outputs.tag }} | cat)
MISSING=$([[ -z "$TAG" ]] && echo 'true' || echo 'false')
echo "missing=$MISSING" >> $GITHUB_OUTPUT
- name: create release
if: ${{ steps.check_release.outputs.missing == 'true' }}
id: create_release
uses: ncipollo/[email protected]
with:
tag: "${{ steps.read-version.outputs.tag }}"
name: Changelog Enforcer ${{ steps.read-version.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: false
- name: update major version tag
if: ${{ steps.check_release.outputs.missing == 'true' }}
uses: richardsimko/update-tag@v1
with:
tag_name: "${{ steps.read-version.outputs.major_tag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}