Skip to content

Apprunner Release

Apprunner Release #21

# 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 GitHub Release workflow
# Manually triggered workflow, takes the "release-version".
# This workflow creates the git commits + git tag for a Nessie Apprunner release.
# It requires a fully successful CI status of the commit going to be released, i.e. we rely on
# the "Main CI" workflow here.
# When this workflow pushes the release tag (e.g. `apprunner-0.5.1`), the `release-publish.yml`
# workflow publishes the release artifacts
# Projectnessie really prefers a linear git history - aka no merges. PRs must not be merged
# while the release workflow runs. In case the git history would not be linear, this workflow will
# fail without having uploaded/pushed any release artifacts.
# Secrets:
# NESSIE_BUILDER GH access-token to push the release-commits+tag to the branch,
# bypassing the required commit-hooks + review.
name: Apprunner Release
on:
# Manually triggered
workflow_dispatch:
inputs:
releaseVersion:
description: 'The version to release - e.g. `0.5.0`'
required: true
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
env:
GIT_TAG: apprunner-${{ github.event.inputs.releaseVersion }}
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
steps:
# Check the given version parameter strings for valid version patterns and inequality.
- name: Check parameters
run: |
# check if tag matches patterns like apprunner-0.5, apprunner-0.10.4.3-alpha1, etc
if [[ ${RELEASE_VERSION} =~ ^[0-9]+[.][0-9.]*[0-9](-[a-zA-Z0-9]+)?$ ]]; then
echo "Parameter check OK"
else
echo "RELEASE_VERSION is not a valid release version ref is ${GITHUB_REF}."
exit 1
fi
### BEGIN runner setup
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java, Maven, Gradle
uses: ./.github/actions/dev-tool-java
### END runner setup
- name: Bump Maven release version ${{ github.event.inputs.releaseVersion }}
run: ./mvnw versions:set -DgenerateBackupPoms=false -DnewVersion=${RELEASE_VERSION}
- name: Configure release-bot-user in git config
run: |
git config --global user.email "apprunner-release-workflow-noreply@projectnessie.org"
git config --global user.name "Apprunner Release Workflow [bot]"
# Record the release-version in git and add the git tag for the release.
- name: Record ${{ github.event.inputs.releaseVersion }} release in git
run: |
git commit -a -m "[release] release apprunner-${RELEASE_VERSION}"
git tag -f ${GIT_TAG}
# Update versions in pom's to next development iteration
- name: Bump Maven next development version version
run: ./mvnw versions:set -DgenerateBackupPoms=false -DnextSnapshot=true
# Record the next development iteration in git
- name: Record next development version in git
run: git commit -a -m "[release] next development iteration"
# Push the 2 git commits and git tag. If this one fails, some other commit was pushed to the
# 'main' branch and break the linear history for the Nessie Apprunner git repo.
# The `release-publish.yml` job will run when the release tag `apprunner-x.y.z` has been pushed.
- name: Push tag + branch
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} ${GIT_TAG}
# Move the default auth settings in ~/.gitconfig back
git config --rename-section http.https://save.github.com/ http.https://github.com/