-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
98 lines (90 loc) · 3.15 KB
/
action.yml
File metadata and controls
98 lines (90 loc) · 3.15 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: CalVer Creation
author: MicahWW
description: Automatically create a new CalVer following YYYY.MM.DD
branding:
icon: 'calendar'
color: 'blue'
inputs:
prefix:
description: 'The prefix that will be found in front of each version tag, and should be reused on the new one.'
required: false
default: ''
timezone:
description: 'The time zone to base the date on, e.g. UTC, America/Chicago, etc. (default: UTC)'
required: false
default: 'UTC'
push_tag:
description: 'If the newly created version tag should be pushed, requires github_token. (default: false)'
required: false
default: 'false'
publish_release:
description: 'If the newly created & pushed tag should have a GitHub Release created, required push_tag=true & github_token. (default: false)'
required: false
default: 'false'
github_token:
description: 'GitHub token for pushing tags'
required: false
set_build_metadata:
description: 'If the build metadata should be set and incremented at the end of the version tag. (default: true)'
required: false
default: 'true'
outputs:
new_version:
description: 'The newly generated version tag'
value: ${{ steps.new_tag.outputs.new_version }}
runs:
using: composite
steps:
- name: Checkout calling repo
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6.2.0
with:
# TODO: Use the .python-version file contents
python-version: '3.13'
- name: Install Python dependencies
shell: bash
run: |
echo "::group::Installing requirements"
pip install -r ${{ github.action_path }}/requirements.txt
echo "::endgroup::"
- name: Pre Check
env:
INPUT_TIMEZONE: ${{ inputs.timezone }}
INPUT_PUSH_TAG: ${{ inputs.push_tag }}
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_PUBLISH_RELEASE: ${{ inputs.publish_release }}
INPUT_SET_BUILD_METADATA: ${{ inputs.set_build_metadata }}
shell: bash
run: python ${{ github.action_path }}/pre_check.py
- name: Generate new tag
id: new_tag
env:
INPUT_TIMEZONE: ${{ inputs.timezone }}
INPUT_PREFIX: ${{ inputs.prefix }}
INPUT_SET_BUILD_METADATA: ${{ inputs.set_build_metadata }}
shell: bash
run: python ${{ github.action_path }}/generate_new_tag.py
- name: Push tag
if: ${{ inputs.push_tag == 'true' }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
shell: bash
run: |
echo "::group::Pushing tag"
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ steps.new_tag.outputs.new_version }}
git push origin ${{ steps.new_tag.outputs.new_version }}
echo "::endgroup::"
- name: Publish Release
if: ${{ inputs.publish_release == 'true' }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
shell: bash
run: |
echo "::group::Publishing release"
gh release create ${{ steps.new_tag.outputs.new_version }} --generate-notes --verify-tag
echo "::endgroup::"