Skip to content

Publish release

Publish release #18

Workflow file for this run

# 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.
# Publish Nessie Apprunner release artifacts
# Triggered when a `apprunner-*` tag is being pushed.
# Publishes the Maven, Python, Docker and Gradle-plugin artifacts.
# GitHub environment name:
# release
# Required secrets:
# OSSRH_ACCESS_ID
# OSSRH_TOKEN
# MAVEN_GPG_PASSPHRASE
# GRADLE_PUBLISH_KEY
# GRADLE_PUBLISH_SECRET
name: Publish release
on:
push:
tags:
- apprunner-*
workflow_dispatch:
inputs:
releaseTag:
description: 'Release tag name to re-release'
required: true
jobs:
publish-release:
name: Publish release
runs-on: ubuntu-latest
steps:
# GH doesn't provide just the tag name, so this step strips `/refs/tags/apprunner-` from `GITHUB_REF`
# and provides the env var `REL_VERSION` or, in case of a manual run, uses the input `releaseTag` as
# the input tag name.
- name: Get release version
id: get_version
run: |
if [[ "${{ github.event_name }}" == "push" ]] ; then
V="${GITHUB_REF/refs\/tags\/}"
else
V="${{ github.event.inputs.releaseTag }}"
fi
# check if tag matches patterns like apprunner-0.5, apprunner-0.10.4.3-alpha1, etc
if [[ ${V} =~ ^apprunner-[0-9]+[.][0-9.]*[0-9](-[a-zA-Z0-9]+)?$ ]]; then
echo "REL_VERSION=${V/apprunner-}" >> ${GITHUB_ENV}
else
echo "Tag must start with apprunner- followed by a valid version (got tag ${V}, ref is ${GITHUB_REF} )"
exit 1
fi
### BEGIN runner setup
- name: Checkout
uses: actions/checkout@v4
if: ${{ github.event_name == 'push' }}
with:
fetch-depth: '0'
- name: Checkout
uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
fetch-depth: '0'
ref: refs/tags/${{ github.event.inputs.releaseTag }}
- name: Setup Java, Maven, Gradle
uses: ./.github/actions/dev-tool-java
with:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
### END runner setup
# Deploys Maven artifacts. Build and test steps were already ran in previous steps.
# Not running tests, because the environment contains secrets.
- name: Publish Maven artifacts for release
id: build_maven
env:
RELEASE_VERSION: ${{ env.REL_VERSION }}
MAVEN_USERNAME: ${{ secrets.OSSRH_ACCESS_ID }}
MAVEN_OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: |
NEXUS_ARGS="-DnexusUrl=https://oss.sonatype.org -DserverId=ossrh -DautoReleaseAfterClose=true"
PROFILES="-Prelease"
GOALS="install org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy"
BUILD_ARGS="-DskipTests"
./mvnw --batch-mode ${GOALS} ${PROFILES} ${NEXUS_ARGS} ${BUILD_ARGS}
# Deploys Gradle plugin. Build and test steps were already ran in previous steps
- name: Publish Gradle Plugin for release
working-directory: ./gradle-plugin/
if: ${{ !env.ACT }}
run: |
./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}