Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release workflow and switch to stable parent #108

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading