Skip to content

Commit 694ba52

Browse files
committed
.github: fix release workflow
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
1 parent 5f6b5ac commit 694ba52

File tree

1 file changed

+70
-8
lines changed

1 file changed

+70
-8
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,69 @@
11
name: release
22

33
on:
4-
push:
5-
tags:
6-
- killbill-commons-*
4+
workflow_dispatch:
5+
inputs:
6+
parent_version:
7+
description: 'New killbill-oss-parent version'
8+
required: false
9+
default: ''
10+
perform_version:
11+
description: 'tag to (re-)perform (in case of release:perform failure)'
12+
required: false
13+
default: ''
14+
15+
env:
16+
MAVEN_FLAGS: "-B --no-transfer-progress"
17+
MAVEN_OPTS: "-Xmx2G -XX:+ExitOnOutOfMemoryError -Dmaven.wagon.rto=60000 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3"
718

819
jobs:
920
release:
1021
runs-on: ubuntu-latest
1122
steps:
1223
- name: Checkout code
24+
if: github.event.inputs.perform_version == ''
25+
uses: actions/checkout@v2
26+
- name: Checkout full repository
27+
# Required when performing an existing release.
28+
if: github.event.inputs.perform_version != ''
1329
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: '0'
32+
- name: Setup git user
33+
env:
34+
BUILD_USER: ${{ secrets.BUILD_USER }}
35+
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
36+
run: |
37+
git config --global user.email "contact@killbill.io"
38+
git config --global user.name "Kill Bill core team"
39+
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:"
1440
- name: Configure Java
41+
uses: actions/setup-java@v1
42+
with:
43+
java-version: 8
44+
- name: Configure Sonatype mirror
45+
uses: s4u/maven-settings-action@v2.3.0
46+
# Go to Sonatype directly to avoid delay syncs (could get rid of this if actions/setup-java were to support mirrors).
47+
with:
48+
mirrors: '[{"id": "oss-releases", "name": "Sonatype releases", "mirrorOf": "*", "url": "https://oss.sonatype.org/content/repositories/releases/"}]'
49+
- name: Download Java dependencies
50+
# We do as much as we can, but it may not be enough (https://issues.apache.org/jira/browse/MDEP-82)
51+
run: |
52+
mvn ${MAVEN_FLAGS} clean install dependency:resolve dependency:resolve-plugins -DskipTests=true -Dgpg.skip=true -Psonatype-oss-release
53+
- name: Update killbill-oss-parent
54+
if: github.event.inputs.parent_version != ''
55+
run: |
56+
echo "Updating killbill-oss-parent pom.xml to ${{ github.event.inputs.parent_version }}:"
57+
mvn ${MAVEN_FLAGS} versions:update-parent -DgenerateBackupPoms=false -DparentVersion="[${{ github.event.inputs.parent_version }}]"
58+
echo "killbill-oss-parent pom.xml changes:"
59+
git --no-pager diff
60+
echo "Downloading new dependencies:"
61+
mvn ${MAVEN_FLAGS} -U clean install -DskipTests=true
62+
63+
git add pom.xml
64+
# Will be pushed as part of the release process, only if the release is successful
65+
git commit -m "pom.xml: update killbill-oss-parent to ${{ github.event.inputs.parent_version }}"
66+
- name: Configure settings.xml for release
1567
uses: actions/setup-java@v1
1668
with:
1769
java-version: 8
@@ -20,14 +72,24 @@ jobs:
2072
server-password: OSSRH_PASS
2173
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
2274
gpg-passphrase: GPG_PASSPHRASE
23-
- name: Download Java dependencies
24-
run: |
25-
mvn -B --no-transfer-progress dependency:resolve -Psonatype-oss-release
26-
mvn -B --no-transfer-progress dependency:resolve-plugins -Psonatype-oss-release
2775
- name: Release artifacts
76+
if: github.event.inputs.perform_version == ''
77+
env:
78+
OSSRH_USER: ${{ secrets.OSSRH_USER }}
79+
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
80+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
81+
# It will still check the remote but hopefully not download much (0 B at 0 B/s). -o isn't safe because of MDEP-82 (see above).
82+
run: |
83+
mvn ${MAVEN_FLAGS} release:clean release:prepare release:perform
84+
- name: Perform release
85+
if: github.event.inputs.perform_version != ''
2886
env:
2987
OSSRH_USER: ${{ secrets.OSSRH_USER }}
3088
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
3189
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
90+
# It will still check the remote but hopefully not download much (0 B at 0 B/s). -o isn't safe because of MDEP-82 (see above).
91+
# See https://issues.apache.org/jira/browse/SCM-729 for why the release.properties file is required.
3292
run: |
33-
mvn -B --no-transfer-progress release:perform -DconnectionUrl=scm:git:git@github.com:killbill/killbill-commons.git -Dtag=${GITHUB_REF#refs/*/}
93+
echo "scm.url=scm\:git\:git@github.com\:${GITHUB_REPOSITORY}.git" > release.properties
94+
echo "scm.tag=${{ github.event.inputs.perform_version }}" >> release.properties
95+
mvn ${MAVEN_FLAGS} release:perform

0 commit comments

Comments
 (0)