Skip to content

Commit

Permalink
Update GitHub Actions for deployment and set deploy flag in environme…
Browse files Browse the repository at this point in the history
…nt variables
  • Loading branch information
mkjsix committed Aug 9, 2024
1 parent a6056d5 commit 5189547
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
run: |
echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
echo "DEPLOY=${{ matrix.deploy }}" >> $GITHUB_ENV
- name: Set up JDK 21
uses: actions/setup-java@v4
Expand Down Expand Up @@ -73,10 +74,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"

- name: Set deploy output
if: ${{ matrix.deploy }}
id: set_deploy
run: echo "deploy=true" >> $GITHUB_ENV

deploy:
runs-on: ubuntu-22.04
needs: [setup, build_and_test]
if: "!contains(github.event.head_commit.message, 'skip ci') && matrix.deploy"
needs: build_and_test
if: "!contains(github.event.head_commit.message, 'skip ci') && env.DEPLOY == 'true'"
steps:
- uses: actions/checkout@v4

Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
id: vars
run: |
echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
echo "DEPLOY=${{ matrix.deploy }}" >> $GITHUB_ENV
- name: Set up JDK 21
uses: actions/setup-java@v4
Expand Down Expand Up @@ -74,8 +75,8 @@ jobs:

deploy:
runs-on: ubuntu-22.04
needs: [setup, build_and_test]
if: "!contains(github.event.head_commit.message, 'skip ci') && matrix.deploy"
needs: build_and_test
if: "!contains(github.event.head_commit.message, 'skip ci') && env.DEPLOY == 'true'"
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -124,7 +125,7 @@ jobs:
softinstigate/restheart:8-graalvm,
softinstigate/restheart:${{ env.VERSION }}-graalvm
- name: Build and Push distroless docker image
- name: Build and Push distroless Docker image
uses: docker/build-push-action@v6
with:
context: ./core/
Expand All @@ -140,7 +141,7 @@ jobs:
release:
runs-on: ubuntu-22.04
needs: deploy
if: "!contains(github.event.head_commit.message, 'skip ci') && matrix.deploy"
if: "!contains(github.event.head_commit.message, 'skip ci') && env.DEPLOY == 'true'"
steps:
- name: Upload GitHub release
uses: softprops/action-gh-release@v2
Expand Down

0 comments on commit 5189547

Please sign in to comment.