forked from actions-ecosystem/action-push-tag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
63 lines (57 loc) · 1.64 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
name: Push Any Git Tag
description: based on Actions Ecosystem Push Tag - Fixed with additional features.
author: Actions Ecosystem & theJeff77
inputs:
tag:
description: A Git tag name.
type: string
required: true
message:
description: A message for the Git tag.
type: string
required: false
ref:
description: Commit SHA or ref (tag) to target for the tag.
type: string
required: false
force:
description: Whether or not to force push (overwrite) the tag if it already exists. Useful for walking tags.
type: boolean
required: false
default: false
always-pass:
description: If this build step should pass no matter what if ref is missing and the tag push fails.
type: boolean
required: false
default: false
runs:
using: "composite"
steps:
- name: Tag
shell: bash
run: |
tag=${{ inputs.tag }}
message=${{ inputs.message }}
ref=${{ inputs.ref }}
force=${{ inputs.force }}
alwaysPass=${{ inputs.always-pass }}
if [ "$force" = "true" ]; then
force="-f"
else
unset force
fi
if [ "$always-pass" = "true" ]; then
alwaysPass=" || true"
else
unset alwaysPass
fi
if [ -z "$ref" ]; then
ref="HEAD"
fi
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${tag}" "${ref}" -m "${message}" ${force} ${alwaysPass}
git push origin "${tag}" ${force} ${alwaysPass}
branding:
icon: search
color: yellow