-
Notifications
You must be signed in to change notification settings - Fork 111
84 lines (77 loc) · 2.58 KB
/
bump-version.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Takes in how to bump version as input
# Commits changes to bump version and outputs the new version and commit hash as output
name: Bump version
on:
pull_request:
workflow_dispatch:
inputs:
change:
type: choice
description: Python script name to update the version
required: true
options:
- bump-dev-num
- promote-dev-build-to-rc
- promote-rc-build-to-release
workflow_call:
inputs:
change:
# Since workflow_call doesn't support 'options' input type,
# we take in a string instead that must be a valid Python script name (excluding the .py part)
# Example: bump-dev-num for bump-dev-num.py
type: string
description: Python script name to change version
required: true
ref:
required: false
description: Commit to bump off of
type: string
is_workflow_call:
type: boolean
default: true
required: false
secrets:
CLIENT_BOT_PAT:
required: true
outputs:
new_version:
value: ${{ jobs.get-new-version.outputs.new_version }}
bump_sha:
value: ${{ jobs.update-version-in-repo.outputs.bump_sha }}
jobs:
get-current-version:
if: ${{ false }}
name: Get new version string
runs-on: ubuntu-22.04
outputs:
current_version: ${{ steps.get-current-version.outputs.current_version }}
steps:
# Checkout the branch where we want to bump the new version
- uses: actions/checkout@v4
with:
token: ${{ secrets.CLIENT_BOT_PAT }}
ref: ${{ inputs.ref }}
- name: Get current version
id: get-current-version
run: echo current_version=$(cat VERSION) >> $GITHUB_OUTPUT
get-new-version:
runs-on: ubuntu-22.04
needs: get-current-version
outputs:
new_version: ${{ steps.get-new-version.outputs.new_version }}
steps:
# Checkout branch where workflow is being called from
- uses: actions/checkout@v4
- name: Install library that parses PEP 440 versions
run: pip install parver -c requirements.txt
working-directory: .github/workflows
- name: Get new version
id: get-new-version
run: echo new_version=$(python3 .github/workflows/${{ inputs.change }}.py ${{ needs.get-current-version.outputs.current_version }}) >> $GITHUB_OUTPUT
update-version-in-repo:
needs: get-new-version
uses: ./.github/workflows/update-version.yml
with:
new_version: ${{ needs.get-new-version.outputs.new_version }}
ref: ${{ inputs.is_workflow_call && inputs.ref || github.ref }}
secrets: inherit