-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
65 lines (60 loc) · 2.2 KB
/
action.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
64
65
name: Auto tagger
description: |
Creates a new version (tag+branch) for a repository based on the labels "major, minor, patch" associated with the current pull-request.
As a result of the tagging:
1. A new tag will be created (e.g my-repo-v1.2.3)
2. A branch will be created, always pointing to the latest major tag (e.g. my-repo-v1)
inputs:
token:
description: 'A Github PAT'
required: true
tag_prefix:
description: 'The prefix for the tag'
required: false
default: ''
force_push:
description: 'If true, force-pushes the newly-created branch'
required: false
default: 'false'
commit_latest:
description: 'If not empty, creates a commit with the provided message in the new branch'
required: false
default: ''
auto_tag_always:
description: 'If true, creates tags and branches on every commit'
required: false
default: 'false'
runs:
using: "composite"
steps:
- uses: smartlyio/check-versioning-action@v5
id: check_version
with:
enforce: true
GITHUB_TOKEN: "${{ inputs.token }}"
- name: Calculate new tag
id: get_new_tag
run: "${{ github.action_path }}/scripts/get_new_tag.sh"
shell: bash
env:
TAG_PREFIX: "${{ inputs.tag_prefix }}"
LABEL_NAME: "${{ steps.check_version.outputs.VERSION_LOWER }}"
- name: Push tag
if: inputs.auto_tag_always == 'true' || (github.event.action == 'closed' && github.event.pull_request.merged)
uses: octokit/request-action@v2.x
with:
route: POST /repos/:repository/git/refs
repository: ${{ github.repository }}
sha: ${{ github.sha }}
ref: refs/tags/${{ steps.get_new_tag.outputs.new_tag }}
env:
GITHUB_TOKEN: "${{ inputs.token }}"
- name: Create major version branch
if: inputs.auto_tag_always == 'true' || (github.event.action == 'closed' && github.event.pull_request.merged)
run: "${{ github.action_path }}/scripts/create_branch.sh"
shell: bash
env:
TAG_PREFIX: "${{ inputs.tag_prefix }}"
LATEST_TAG: "${{ steps.get_new_tag.outputs.new_tag }}"
FORCE_PUSH: "${{ inputs.force_push }}"
COMMIT_LATEST: "${{ inputs.commit_latest }}"