-
Notifications
You must be signed in to change notification settings - Fork 133
118 lines (97 loc) · 4.37 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
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
# Copyright (C) 2020 Dremio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Projectnessie Update development version on 'main' (or another branch) to the next
# patch/minor/major version as a -SNAPSHOT version.
# Manually triggered workflow, takes the optional "bumpType" and "bumpBranch" arguments.
# This workflow creates a Git commit to bump the development version.
# Secrets:
# NESSIE_BUILDER GH access-token to push the release-commits+tag to the branch,
# bypassing the required commit-hooks + review.
name: Bump version
on:
# Manually triggered
workflow_dispatch:
inputs:
bumpType:
description: 'Bump what (`patch`, `minor`, `major`), defaults to `patch`'
required: true
type: string
default: "patch"
bumpBranch:
description: 'The branch name to bump the version in, leave empty to bump the version on the `main` branch.'
required: true
type: string
default: "main"
jobs:
create-release:
name: Bump version
runs-on: ubuntu-24.04
if: github.repository == 'projectnessie/nessie'
env:
BUMP_ON_BRANCH: ${{ github.event.inputs.bumpBranch }}
BUMP_TYPE: ${{ github.event.inputs.bumpType }}
steps:
### BEGIN runner setup
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.BUMP_ON_BRANCH }}
- name: Setup Java, Gradle
uses: ./.github/actions/dev-tool-java
### END runner setup
- name: Get previous version information
run: echo "PREVIOUS_VERSION=$(cat version.txt)" >> ${GITHUB_ENV}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4
env:
# Same as for ci.yml
GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT: java-17
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: nessie-ci
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE: ci
with:
cache-read-only: true
validate-wrappers: false
- name: Bump to version
run: ./gradlew :bumpVersion --bumpType ${{ env.BUMP_TYPE }}
- name: Get bumped version information
run: |
echo "BUMPED_VERSION=$(cat version.txt)" >> ${GITHUB_ENV}
echo "BUMPED_VERSION_NO_SNAPSHOT=${BUMPED_VERSION%-SNAPSHOT}" >> ${GITHUB_ENV}
- name: Configure bump-version-bot-user in git config
run: |
git config --global user.email "nessie-bump-version-workflow-noreply@projectnessie.org"
git config --global user.name "Nessie Bump Version Workflow [bot]"
# Record the next development iteration in git
- name: Record next development version in git
run: git commit -a -m "[bump-version] bump to ${BUMPED_VERSION}"
- name: Version information
run: |
cat <<! >> $GITHUB_STEP_SUMMARY
## Version information
| **Previous Nessie version** | ${PREVIOUS_VERSION} |
| **Current Nessie version** | ${BUMPED_VERSION} |
| **Bump type** | ${BUMP_TYPE} |
| Git HEAD | \`$(git rev-parse HEAD)\` |
!
# Push the Git commit. If this one fails, some other commit was pushed to the
# 'main' branch and break the linear history for the Nessie git repo.
- name: Push Git commit
run: |
# Push directly using the remote repo URL, which includes the secret so this job can push to the repo
UPSTREAM="https://${{ secrets.NESSIE_BUILDER }}@github.com/${GITHUB_REPOSITORY}.git"
# Move the default auth settings in ~/.gitconfig out of the way, so the git-push can use the token
git config --rename-section http.https://github.com/ http.https://save.github.com/
git push --no-verify "${UPSTREAM}" HEAD:${GITHUB_REF}
# Move the default auth settings in ~/.gitconfig back
git config --rename-section http.https://save.github.com/ http.https://github.com/