-
Notifications
You must be signed in to change notification settings - Fork 10
175 lines (156 loc) · 6.65 KB
/
Copy pathrelease.yml
File metadata and controls
175 lines (156 loc) · 6.65 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
##
## Copyright (C) 2025 Dremio Corporation
##
## 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.
##
name: Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release version (e.g., 0.1.0)'
required: true
nextVersion:
description: 'Next development version (e.g., 0.1.1 - the suffix -SNAPSHOT will be added automatically)'
required: true
dryRun:
description: 'Dry run (true or false)'
required: false
default: false
type: boolean
# Required permissions for pushing to main branch and creating tags, issues and discussions
permissions:
contents: write
packages: write
# TODO enable
# issues: write
# discussions: write
jobs:
release:
name: "Release version ${{ inputs.releaseVersion }} (dry run: ${{ inputs.dryRun }})"
# Only run in the original repository, not forks
if: github.repository == 'dremio/iceberg-auth-manager'
runs-on: ubuntu-latest
steps:
- name: Validate inputs
run: |
if [[ "${{ github.event.inputs.releaseVersion }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ && ! "${{ github.event.inputs.releaseVersion }}" =~ -SNAPSHOT$ ]]; then
RELEASE_VERSION="${{ github.event.inputs.releaseVersion }}"
echo RELEASE_VERSION="${RELEASE_VERSION}" >> $GITHUB_ENV
echo TAG_NAME="authmgr-${RELEASE_VERSION}" >> $GITHUB_ENV
echo "Release version: $RELEASE_VERSION"
else
echo "Invalid release version format. Expected format: x.y.z or x.y.z-qualifier"
exit 1
fi
if [[ "${{ github.event.inputs.nextVersion }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ && ! "${{ github.event.inputs.nextVersion }}" =~ -SNAPSHOT$ ]]; then
NEXT_VERSION="${{ github.event.inputs.nextVersion }}-SNAPSHOT"
echo NEXT_VERSION="${NEXT_VERSION}" >> $GITHUB_ENV
echo "Next development version: $NEXT_VERSION"
else
echo "Invalid next development version format. Expected format: x.y.z or x.y.z-qualifier"
exit 1
fi
# The access token is valid for (only) one hour. See https://github.com/actions/create-github-app-token for details.
- name: Generate access token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.DREMIO_RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.DREMIO_RELEASE_BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0 # Fetch all history for all branches and tags
ref: main # Checkout the main branch
- name: Verify current version
run: |
if [[ ! -f version.txt ]]; then
echo "version.txt file not found!"
exit 1
fi
current_version=$(cat version.txt)
if [[ ! "$current_version" =~ -SNAPSHOT$ ]]; then
echo "Current version is not a SNAPSHOT version: $current_version"
exit 1
fi
- name: Configure Git
# See https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url --push origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }}
- name: Update version for release
run: |
echo "${RELEASE_VERSION}" > version.txt
git add version.txt
git commit -a -m "chore(release): release version ${RELEASE_VERSION}"
git tag -a -m "chore(release): tag version ${RELEASE_VERSION}" ${TAG_NAME}
- name: Push tag
run: |
if [[ "${{ github.event.inputs.dryRun }}" == "false" ]]; then
echo "Pushing tag ${TAG_NAME}."
git push origin ${TAG_NAME}
else
echo "Dry run enabled, not pushing tag."
fi
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build with Gradle
run: ./gradlew --no-scan build publish -x intTest -Prelease
- name: Print POMs names and contents
run: |
find . -path "*/build/staging-deploy/*" -name "*.pom" -exec sh -c 'echo ----; echo POM file: {}; cat {}' \;
- name: JReleaser full release
env:
JRELEASER_DRY_RUN: ${{ github.event.inputs.dryRun }}
JRELEASER_TAG_NAME: ${TAG_NAME}
JRELEASER_MAVENCENTRAL_STAGE: FULL
JRELEASER_GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.DEVBOT_CENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.DEVBOT_CENTRAL_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.DEVBOT_GPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.DEVBOT_GPG_PRIVATE_KEY }}
run: ./gradlew --no-scan jreleaserFullRelease --info
- name: Update to next development version
run: |
echo "${NEXT_VERSION}" > version.txt
git add version.txt
git commit -m "chore(release): set next development version to ${NEXT_VERSION}"
- name: Push main branch
run: |
if [[ "${{ github.event.inputs.dryRun }}" == "false" ]]; then
echo "Pushing changes to main branch."
git push origin main
else
echo "Dry run enabled, not pushing to main branch."
fi
- name: Print JReleaser information
if: always()
run: |
if [ -f build/jreleaser/output.properties ]; then
echo "JReleaser output properties:"
cat build/jreleaser/output.properties
else
echo "No JReleaser output properties found."
fi
if [ -f build/jreleaser/trace.log ]; then
echo "JReleaser logs:"
cat build/jreleaser/trace.log
else
echo "No JReleaser logs found."
fi