Skip to content

Commit

Permalink
Refactor GitHub Actions for branches: Update timeout minutes for buil…
Browse files Browse the repository at this point in the history
…d job and remove unnecessary version variable setting
  • Loading branch information
mkjsix committed Oct 15, 2024
1 parent 3b3624a commit fc2d1e8
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ on:
- "*" # Ignore all tags

jobs:
# Build and test the project
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-22.04
strategy:
matrix:
mongodb-version: ["5.0", "6.0"]
deploy: [false] # Added here as part of strategy
timeout-minutes: 20
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -31,25 +31,19 @@ jobs:
distribution: "temurin"
java-version: "21"

- name: Set VERSION and SHA
id: vars
run: |
echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
- 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 }}"

# Deploy the project to Maven Central and DockerHub
deploy:
needs: build
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-22.04
strategy:
matrix:
mongodb-version: ["7.0"]
deploy: [true]
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -65,12 +59,11 @@ jobs:
distribution: "temurin"
java-version: "21"

- name: Set VERSION and SHA
- name: Set SHA
id: vars
run: |
echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
- name: Import private gpg key
run: |
printf "%s" "$GPG_PRIVATE_KEY" > private.key
Expand Down

0 comments on commit fc2d1e8

Please sign in to comment.