Manual Integration - maintenance #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual Integration - maintenance | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The maintenance version to build' | |
required: true | |
type: string | |
env: | |
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log. | |
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work. | |
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" | |
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used | |
# when running from the command line. | |
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins. | |
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-tags: true | |
- name: Verify and print new build number | |
run: | | |
if echo '${{ inputs.version }}' |grep -Eq '^1[.][0-9]+[.][0-9]+$'; then | |
echo Tag '${{ inputs.version }}', New version '${{ inputs.version }}' | |
else | |
echo 'unexpected tag format - aborting' | |
exit -1 | |
fi | |
## Configure JDK 11 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'maven' | |
## Build with maven | |
- name: Prepare maven settings | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mkdir -p ~/.m2 | |
echo "<settings><servers><server><id>github</id><username>x-access-token</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml | |
- name: Set version | |
id: version | |
run: | | |
echo Releasing as ${{ inputs.version }} | |
mvn $MAVEN_CLI_OPTS versions:set -DnewVersion=${{ inputs.version }} | |
- name: Perform build | |
run: mvn $MAVEN_CLI_OPTS package | |
## Deploy | |
- name: Deploy package | |
env: | |
GPG_EXECUTABLE: gpg | |
GPG_SECRET_KEYS: ${{ secrets.LEVIGO_GPG_KEYS }} | |
GPG_OWNERTRUST: ${{ secrets.LEVIGO_GPG_OWNERTRUST }} | |
GPG_PASSPHRASE: ${{ secrets.LEVIGO_GPG_PASSPHRASE }} | |
SONATYPE_USERNAME: ${{ secrets.LEVIGO_SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.LEVIGO_SONATYPE_PASSWORD }} | |
run: | | |
echo "$GPG_SECRET_KEYS" | base64 --decode | $GPG_EXECUTABLE --import --no-tty --batch --yes | |
echo "$GPG_OWNERTRUST" | base64 --decode | $GPG_EXECUTABLE --import-ownertrust --no-tty --batch --yes | |
mvn $MAVEN_CLI_OPTS deploy --settings .github/settings.xml -Dmaven.test.skip.exec=true -U -Prelease | |
## Update README.md | |
- name: Edit README.md to contain version number | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git checkout maintenance/maint-1x | |
git reset --hard HEAD | |
sed -ri "s,<version>.*</version>,<version>${{ inputs.version }}</version>," README.md | |
sed -ri "s,version-[0-9a-z.]+-,version-${{ inputs.version }}-," README.md | |
sed -ri "s,gwt-spring-boot-starter/tree/[0-9a-z.]+,gwt-spring-boot-starter/tree/${{ inputs.version }}," README.md | |
git add README.md | |
git commit -m "Edit README.md to contain correct version" | |
git tag maintenance_1_x-${{ inputs.version }} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: maintenance/maint-1x | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ inputs.version }} | |
release_name: Release ${{ inputs.version }} | |
## Notify Slack | |
- name: Notify slack | |
uses: hennejg/slack-build-notifier@v1.1 | |
with: | |
username: GitHub | |
icon_emoji: octocat | |
text: Released new version `${{ inputs.version }}` of *${{ github.repository }}* to maven central | |
channel: ci_jwt | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |