-
Notifications
You must be signed in to change notification settings - Fork 5
52 lines (46 loc) · 1.49 KB
/
lib-tag-release.yaml
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
# # Example of workflow trigger for calling workflow (the client).
# name: tag-release
# on:
# push:
# branches: ["Release-*"]
# jobs:
# tag:
# uses: qiime2/distributions/.github/workflows/lib-tag-release.yaml@dev
on:
workflow_call: {}
jobs:
increment-release-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup
shell: bash
run: |
IFS='-' read -r _ release <<< $(git branch)
echo "release=$release" >> $GITHUB_ENV
echo "default_tag=$release.-1" >> $GITHUB_ENV
- name: Get last tag
id: get_last_tag
shell: bash
run: |
last_tag=$(git describe --abbrev=0 --tags 2>/dev/null || echo ${{ env.default_tag }})
echo "last_tag=$last_tag" >> "$GITHUB_ENV"
- name: Increment tag
id: increment_tag
shell: bash
run: |
last_tag=${{ env.last_tag }}
IFS='.' read -r major minor patch <<< "$last_tag"
incremented_tag="$major.$minor.$((patch + 1))"
echo "RELEASE_TAG=$incremented_tag" >> "$GITHUB_ENV"
- uses: EndBug/add-and-commit@v9
with:
default_author: user_info
author_name: q2d2
author_email: [email protected]
message: "REL: ${{ env.RELEASE_TAG }}"
commit: --allow-empty
tag: -a "${{ env.RELEASE_TAG }}" -m "${{ github.event.repository.name }} ${{ env.RELEASE_TAG }}"