Skip to content

Stable Release

Stable Release #94

Workflow file for this run

# This workflow builds stable releases
name: Build stable release
on:
push:
tags:
- "*"
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- mongodb-version: 4.2
- mongodb-version: 4.4
- mongodb-version: 5.0
- mongodb-version: 6.0
deploy: true
- mongodb-version: 7.0
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Set the VERSION
id: vars
run: |
echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_OUTPUT
echo "VERSION=${{steps.vars.outputs.VERSION}}"
- name: Build and Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: mvn -B verify -Dmongodb.version="${{ matrix.mongodb-version }}" -Dkarate.options="${{ matrix.karate-options }}"
- name: Set up QEMU
if: ${{ matrix.deploy }}
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: ${{ matrix.deploy }}
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: ${{ matrix.deploy }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and Push multi-arch Docker images
if: ${{ matrix.deploy }}
uses: docker/build-push-action@v4
with:
context: ./core/
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7
push: true # push all images built
pull: true # pull all required images before building
tags: softinstigate/restheart:latest,softinstigate/restheart:7,softinstigate/restheart:7.6,softinstigate/restheart:${{steps.vars.outputs.VERSION}}
- name: Build and Push GraalVM Docker image
if: ${{ matrix.deploy }}
uses: docker/build-push-action@v4
with:
context: ./core/
file: ./core/Dockerfile.graalvm
push: true # push all images built
pull: true # pull all required images before building
tags: softinstigate/restheart:graalvm,softinstigate/restheart:latest-graalvm,softinstigate/restheart:7-graalvm,softinstigate/restheart:7.6-graalvm,softinstigate/restheart:${{steps.vars.outputs.VERSION}}-graalvm
- name: Build and Push distroless docker image
if: ${{ matrix.deploy }}
uses: docker/build-push-action@v4
with:
context: ./core/
file: ./core/Dockerfile.distroless
push: true # push all images built
pull: true # pull all required images before building
tags: softinstigate/restheart:distroless,softinstigate/restheart:latest-distroless,softinstigate/restheart:7-distroless,softinstigate/restheart:7.6-distroless,softinstigate/restheart:${{steps.vars.outputs.VERSION}}-distroless
- name: Upload GitHub release
if: ${{ matrix.deploy }}
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
Release ${{ github.ref }}
files: |
core/target/restheart.tar.gz
core/target/restheart.zip
core/target/restheart.jar
draft: true
prerelease: false
- name: Import private gpg key
if: ${{ matrix.deploy }}
run: |
printf "%s" "$GPG_PRIVATE_KEY" > private.key
gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
continue-on-error: true
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Deploy to Maven Central
if: ${{ matrix.deploy }}
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 clean deploy -Pdeploy -DskipTests -s settings.xml
continue-on-error: true
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}