Skip to content

Commit

Permalink
Revert "Refactor GitHub Actions for branches"
Browse files Browse the repository at this point in the history
This reverts commit ee36c97.
  • Loading branch information
mkjsix committed Oct 15, 2024
1 parent ee36c97 commit 8142b3f
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ on:
- "*"

jobs:
# Job 1: Build job (runs by default for non-deployment)
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- mongodb-version: ["5.0", "6.0"]
- mongodb-version: "5.0"
- mongodb-version: "6.0"
- mongodb-version: "7.0"
deploy: true
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
Expand All @@ -43,69 +45,47 @@ jobs:
echo "SHA=${{steps.vars.outputs.SHA}}"
- name: Build and Test
if: ${{ ! matrix.deploy }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"

# Job 2: Deploy job if mongodb-version is 7.0
deploy:
needs: build
runs-on: ubuntu-22.04
if: ${{ always() && matrix.mongodb-version == '7.0' }}
strategy:
matrix:
include:
- mongodb-version: ["7.0"]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"

- name: Set the VERSION
id: vars
run: |
echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_OUTPUT
- 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
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 -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
mvn -B deploy -Pdeploy -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Set up QEMU
if: ${{ matrix.deploy }}
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: ${{ matrix.deploy }}
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: ${{ matrix.deploy }}
uses: docker/login-action@v3
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@v6
with:
context: ./core/
Expand All @@ -120,6 +100,7 @@ jobs:
tags: softinstigate/restheart-snapshot:${{steps.vars.outputs.SHA}}

- name: Build and Push GraalVM Docker image
if: ${{ matrix.deploy }}
uses: docker/build-push-action@v6
with:
context: ./core/
Expand All @@ -133,6 +114,7 @@ jobs:
tags: softinstigate/restheart-snapshot:${{steps.vars.outputs.SHA}}-graalvm

- name: Build and Push distroless docker image
if: ${{ matrix.deploy }}
uses: docker/build-push-action@v6
with:
context: ./core/
Expand Down

0 comments on commit 8142b3f

Please sign in to comment.