Skip to content

Commit

Permalink
add release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
larsk21 committed Dec 3, 2024
1 parent 34ac1af commit cfcfb04
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/prepare-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

if [ $# -lt 2 ];
then
echo "usage: $0 <release-version> <new-snapshot-version>" >&2
echo "" >&2
echo "release-version : Version of the next release, e.g., 3.1.0" >&2
echo "new-snapshot-version: Version of the upcoming nightly releases without the -SNAPSHOT suffix, e.g., 3.2.0" >&2
return 1
fi

git switch -C prepare-release/$1 || exit 1

set_version_and_commit() {
./mvnw versions:set -DnewVersion=$1 -DgenerateBackupPoms=false || return 1

git add pom.xml || return 1
git add "**/pom.xml" 2> /dev/null

git commit -m "$2" || return 1
}

set_version_and_commit "$1" "[Release] Version $1"
set_version_and_commit "$2-SNAPSHOT" "[Release] Update version to $2-SNAPSHOT"
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release

# workflow triggers
on:
# manually
workflow_dispatch:
# releases
release:
types: [published]

jobs:
verify:
name: Verify build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Setup Java and Maven cache
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'maven'

- name: Verify build
run: >
./mvnw clean verify
--batch-mode
--update-snapshots
--no-transfer-progress
release:
name: Release
runs-on: ubuntu-latest
needs: [verify]
strategy:
fail-fast: true

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Setup Java and Maven cache
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Deploy to staging and release
run: >
./mvnw clean deploy -P release
-DskipTests
--batch-mode
--update-snapshots
--no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

0 comments on commit cfcfb04

Please sign in to comment.