-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.96 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
62
63
name: Create release for github actions
on:
workflow_call:
jobs:
release:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies and build
run: npm ci && npm run build
- name: "Get latest release tag"
id: latest_release
run: |
current_version=`gh release list --limit 30 | grep Latest | awk '{ print $1;}'`
if [ -z "$current_version" ]
then
echo "No release found"
echo "Creating tag for firt release"
echo "version=v1.0.0" >> $GITHUB_ENV
else
echo "version=${current_version}" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Display version
run: |
# Display the version from the environment
echo "Latest Version: ${{ env.version }}"
- id: label
uses: zwaldowski/match-label-action@v4
with:
allowed: major,minor,patch
default_match: none
- uses: actions-ecosystem/action-bump-semver@v1
if: ${{ steps.label.outputs.match != 'none' }}
id: bump-semver
with:
current_version: ${{ env.version }}
level: ${{steps.label.outputs.match}}
- name: "Creating Release"
if: ${{ steps.label.outputs.match != 'none' }}
run: |
gh release create ${{ steps.bump-semver.outputs.new_version }} --title " ${{ steps.bump-semver.outputs.new_version }}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}
- uses: JasonEtco/build-and-tag-action@v2
if: ${{ steps.label.outputs.match != 'none' }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.bump-semver.outputs.new_version }}