Skip to content

Release

Release #21

Workflow file for this run

##
## 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