-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (92 loc) · 3.65 KB
/
bump-version-release.yaml
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
99
100
101
name: Bump Version Release
# Reusable workflow for creating release tags using bumpversion
on:
workflow_call:
inputs:
release-type:
description: "Scope of the release (major, minor or patch)."
required: true
type: string
changelog:
description: "Create changelog for release."
required: false
default: true
type: boolean
changelog-file:
description: Path to the changelog file in the GitHub repository
required: false
default: "CHANGELOG.md"
type: string
changelog-config:
description: "Changelog config path."
required: false
default: ""
type: string
working-directory:
description: "Working directory containing `.bumpversion.cfg`. (Default is .)"
required: false
default: "."
type: string
secrets:
github-username:
description: "The GitHub username for committing the changes."
required: true
github-email:
description: "The GitHub email for committing the changes."
required: true
github-token:
description: "The GitHub token for committing the changes."
required: true
# Map the workflow outputs to job outputs
outputs:
release-version:
description: "The bumped version."
value: ${{ jobs.release.outputs.release-version }}
old-version:
description: "The old version in your `.bumpversion.cfg` file."
value: ${{ jobs.release.outputs.old-version }}
jobs:
release:
runs-on: ubuntu-22.04
# Map the job outputs to step outputs
outputs:
release-version: ${{ steps.bump-version.outputs.release-version }}
old-version: ${{ steps.bump-version.outputs.old-version }}
steps:
- name: Check out repository
uses: bakdata/ci-templates/actions/[email protected]
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false # required for pushing to protected branch later
fetch-depth: 0 # required for changelog generation
- name: Bump version
id: bump-version
uses: bakdata/ci-templates/actions/[email protected]
with:
release-type: ${{ inputs.release-type }}
working-directory: ${{ inputs.working-directory }}
- name: Create changelog
id: build-changelog
uses: bakdata/ci-templates/actions/[email protected]
if: ${{ inputs.changelog }}
with:
github-token: ${{ secrets.github-token }}
tag: ${{ steps.bump-version.outputs.release-version }}
changelog-file: ${{ inputs.changelog-file }}
- name: Commit and push changes including .bumpversion.cfg file
uses: bakdata/ci-templates/actions/[email protected]
with:
ref: ${{ github.event.repository.default_branch }}
commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}"
github-username: ${{ secrets.github-username }}
github-email: ${{ secrets.github-email }}
github-token: ${{ secrets.github-token }}
- name: Tag and release
uses: bakdata/ci-templates/actions/[email protected]
with:
tag: "${{ steps.bump-version.outputs.release-version }}"
github-username: ${{ secrets.github-username }}
github-email: ${{ secrets.github-email }}
github-token: ${{ secrets.github-token }}
release-title: "${{ steps.bump-version.outputs.release-version }}"
release-body: "${{ steps.build-changelog.outputs.single-changelog }}"