Skip to content

Commit

Permalink
Merge pull request #108 from vitruv-tools/release-workflow
Browse files Browse the repository at this point in the history
Add release workflow and switch to stable parent
  • Loading branch information
larsk21 authored Nov 26, 2024
2 parents 393d4cd + 937fe4f commit c7c0450
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 14 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 }}
15 changes: 1 addition & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>tools.vitruv</groupId>
<artifactId>parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.4</version>
</parent>

<!-- Project Information -->
Expand Down Expand Up @@ -75,19 +75,6 @@
</snapshots>
</repository>

<!-- allow snapshots -->
<repository>
<id>ossrh-snapshots</id>
<name>OSSRH Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>

<!-- for p2 dependencies, `groupId` specifies the repository -->
<repository>
<id>emf-compare</id>
Expand Down

0 comments on commit c7c0450

Please sign in to comment.