Skip to content

Stable Release

Stable Release #174

Workflow file for this run

name: Stable Release
on:
push:
branches:
- "!master" # Ignore the master branch
tags:
- "*" # Trigger on any tag
jobs:
# Build and test the project
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ["6.0", "7.0", "8.0"]
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
distribution: "graalvm"
java-version: "25"
cache: "maven"
- name: Build and Test
run: |
mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"
- name: Upload build artifacts for Docker jobs
if: matrix.mongodb-version == '8.0'
uses: actions/upload-artifact@v6
with:
name: restheart-artifacts
path: |
core/target/restheart.jar
core/target/lib/*.jar
core/target/plugins/*.jar
core/target/plugins/lib/*.jar
# Release the project on GitHub
release:
if: "!contains(github.event.head_commit.message, 'skip ci')"
needs: build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}
strategy:
matrix:
mongodb-version: ["8.0"]
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
distribution: "graalvm"
java-version: "25"
cache: "maven"
- name: Build and Test
run: mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"
- name: Set VERSION
id: set_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Extract Version Components
id: extract_version
run: |
MAJOR=$(echo "${{ env.VERSION }}" | cut -d '.' -f 1)
MINOR=$(echo "${{ env.VERSION }}" | cut -d '.' -f 2)
PATCH=$(echo "${{ env.VERSION }}" | cut -d '.' -f 3)
# Export the major, minor, and patch versions as environment variables
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
echo "MINOR=$MINOR" >> $GITHUB_ENV
echo "PATCH=$PATCH" >> $GITHUB_ENV
- name: Upload GitHub release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
# Release ${{ env.VERSION }}
files: |
core/target/restheart.tar.gz
core/target/restheart.zip
draft: true
prerelease: false
build-docker-standard:
if: "!contains(github.event.head_commit.message, 'skip ci')"
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ["8.0"]
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: restheart-artifacts
path: core/target/
- name: Set VERSION
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract Version Components
run: |
MAJOR=$(echo "$VERSION" | cut -d '.' -f 1)
MINOR=$(echo "$VERSION" | cut -d '.' -f 2)
PATCH=$(echo "$VERSION" | cut -d '.' -f 3)
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
echo "MINOR=$MINOR" >> $GITHUB_ENV
echo "PATCH=$PATCH" >> $GITHUB_ENV
- name: Set Docker Tags for standard images
id: set_tags
run: |
TAGS="softinstigate/restheart:latest,softinstigate/restheart:$MAJOR,softinstigate/restheart:$MAJOR.$MINOR,softinstigate/restheart:$MAJOR.$MINOR.$PATCH"
echo "TAGS=$TAGS" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and Push multi-arch Docker images
uses: docker/build-push-action@v6
with:
context: ./core/
platforms: |
linux/amd64,
linux/arm64
push: true
pull: true
tags: ${{ env.TAGS }}
deploy-maven-central:
if: "!contains(github.event.head_commit.message, 'skip ci')"
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ["8.0"]
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "25"
cache: "maven"
- name: Import private gpg key
run: |
printf "%s" "$GPG_PRIVATE_KEY" > private.key
gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Deploy to Maven Central
run: |
MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" \
mvn -B deploy -Pdeploy -DskipTests -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# Separate job to call the reusable workflow
call-native-image-release:
if: "!contains(github.event.head_commit.message, 'skip ci')"
needs: release
uses: ./.github/workflows/native-image-release.yml
secrets: inherit
with:
version: "${{ needs.release.outputs.version }}"