-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (112 loc) · 4.59 KB
/
Copy pathbump-version.yml
File metadata and controls
131 lines (112 loc) · 4.59 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Bump version
on:
workflow_run:
workflows: [ Test ]
branches: [ main, temp/hotfix ]
types: [ completed ]
# Workflow dispatch can be used to promote a pre-release to a normal release
workflow_dispatch:
env:
WORKFLOW_OUT_DIR: ./workflow-outputs
jobs:
bump-version:
if: |
github.event_name == 'workflow_dispatch' ||
(
github.ref_name == 'main' &&
github.event.workflow_run.conclusion == 'success'
)
env:
JDK_VERSION: 21
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Run checkout github action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: 'true'
submodules: 'true'
fetch-depth: 0
- name: Setup GitHub Runner workflow
uses: ./mobile-android-pipelines/actions/setup-runner
with:
jdk-version: 21
- name: Create a pre-release unless the workflow was triggered manually
id: pre-release
# If the workflow is triggered automatically (e.g. by merging a PR) create a pre-release
# If the workflow is triggered manually (i.e. through the Github UI) create a stable release
run: echo "enabled=$IS_AUTOMATIC_RELEASE" >> "$GITHUB_OUTPUT"
env:
IS_AUTOMATIC_RELEASE: ${{ github.event_name != 'workflow_dispatch' }}
- name: Ensure stable release is created from an existing pre-release
if: ${{ steps.pre-release.outputs.enabled == 'false' }}
uses: ./actions/ensure-pre-release-tag
- name: Increment the release version using Conventional Commits
id: versioning
uses: ./mobile-android-pipelines/actions/increment-version
with:
pre-release-type: ${{ steps.pre-release.outputs.enabled == 'true' && 'alpha' || '' }}
- name: Publish release tags
if: ${{ steps.versioning.outputs.current_version != steps.versioning.outputs.new_version }}
uses: ./mobile-android-pipelines/actions/publish-release-tag
- name: Create workflow outputs
uses: ./actions/write-bump-version-outputs
with:
current-version: ${{ steps.versioning.outputs.current_version }}
new-version: ${{ steps.versioning.outputs.new_version }}
workflow-out-dir: ${{ env.WORKFLOW_OUT_DIR }}
- name: Create GitHub release
if: steps.versioning.outputs.current_version != steps.versioning.outputs.new_version
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
tag_name: ${{ steps.versioning.outputs.new_version }}
draft: false
prerelease: ${{ steps.pre-release.outputs.enabled }}
generate_release_notes: true
- name: Clean workspace
uses: ./mobile-android-pipelines/actions/clean-workspace
bump-hotfix-version:
if: |
github.ref_name == 'temp/hotfix' &&
github.event.workflow_run.conclusion == 'success'
env:
JDK_VERSION: 21
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Run checkout github action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: 'true'
submodules: 'true'
fetch-depth: 0
- name: Setup GitHub Runner workflow
uses: ./mobile-android-pipelines/actions/setup-runner
with:
jdk-version: 21
- name: Get version from commit message
id: get-version
uses: ./mobile-android-pipelines/actions/get-next-version-from-commit-message
- name: Increment and push hotfix git tag
id: increment-version
uses: ./mobile-android-pipelines/actions/increment-hotfix-tag
with:
version-name: ${{ steps.get-version.outputs.next-version }}
- name: Create workflow outputs
uses: ./actions/write-bump-version-outputs
with:
current-version: ${{ steps.get-version.outputs.next-version }}
new-version: ${{ steps.increment-version.outputs.incremented-version }}
workflow-out-dir: ${{ env.WORKFLOW_OUT_DIR }}
- name: Create GitHub release
if: steps.get-version.outputs.next-version != steps.increment-version.outputs.incremented-version
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
tag_name: ${{ steps.increment-version.outputs.incremented-version }}
draft: false
prerelease: false
generate_release_notes: true
- name: Clean workspace
uses: ./mobile-android-pipelines/actions/clean-workspace