-
Notifications
You must be signed in to change notification settings - Fork 111
63 lines (58 loc) · 1.97 KB
/
update-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
# Takes in a new version as input
# Changes the version in the whole repo and outputs the commit hash as output
name: Update version in repo
on:
workflow_dispatch:
inputs:
new_version:
type: string
description: Version string to set in the repo
required: true
workflow_call:
inputs:
new_version:
type: string
description: Version string to set in the repo
required: true
ref:
type: string
description: commit/branch to change version
required: false
# A hack to tell if workflow is triggered by workflow_call or not
# Calling workflows should not set this input
# If workflow is triggered by workflow_dispatch, this should be set to the default boolean value: false
is_workflow_call:
type: boolean
default: true
required: false
secrets:
CLIENT_BOT_PAT:
required: true
outputs:
bump_sha:
value: ${{ jobs.update-version-in-repo.outputs.bump_sha }}
jobs:
update-version-in-repo:
name: Update version in repo
runs-on: ubuntu-22.04
outputs:
bump_sha: ${{ steps.get-bump-commit-sha.outputs.bump_sha }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CLIENT_BOT_PAT }}
ref: ${{ inputs.ref }}
- name: Update version in repo
uses: .github/action/update-version
with:
new_version: ${{ inputs.new_version }}
- name: Commit new version
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Auto-bump version to ${{ inputs.new_version }}
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
tagging_message: ${{ inputs.new_version }}
branch: ${{ inputs.is_workflow_call && inputs.ref || github.ref }}
- name: Output bump commit hash for next jobs to use
id: get-bump-commit-sha
run: echo "bump_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT