-
Notifications
You must be signed in to change notification settings - Fork 4
109 lines (95 loc) · 3.7 KB
/
release-publish.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
# 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 }}