generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 25
53 lines (47 loc) · 1.75 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
name: "Release Workflow"
on:
push:
branches:
- 'releases/v1.6'
- 'master'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: read versions
id: read-version
run: |
echo ::set-output name=version::$(jq -r ".version" package.json)
echo ::set-output name=tag::v$(jq -r ".version" package.json)
echo ::set-output name=major_tag::v$(jq -r ".version" package.json | cut -d '.' -f 1)
- 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 }} || [[ $? == 1 ]] && echo '')
MISSING=$([[ -z "$TAG" ]] && echo 'true' || echo 'false')
echo ::set-output name=missing::$MISSING
- name: create release
if: ${{ steps.check_release.outputs.missing == 'true' }}
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.read-version.outputs.tag }}"
release_name: Changelog Enforcer ${{ steps.read-version.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: false
- name: update major version tag
uses: richardsimko/update-tag@v1
with:
tag_name: "${{ steps.read-version.outputs.major_tag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}