Skip to content

Commit 4d6c3c1

Browse files
committed
Simplify logic to check for main in CI
1 parent 6bf4b92 commit 4d6c3c1

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

.github/workflows/test_and_release.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,19 @@ jobs:
88
needs: [ ]
99
steps:
1010
- uses: actions/checkout@v4.2.2
11-
- name: Check if we are head of main
12-
id: check_head_of_main
13-
run: |
14-
git fetch origin main &&
15-
MAIN=`git rev-parse origin/main` &&
16-
echo "head_of_main=$MAIN" >> $GITHUB_OUTPUT &&
17-
CURRENT=`git rev-list -n 1 ${{ github.ref }} || echo "NOT_MAIN"` &&
18-
echo "current_job_ref=$CURRENT" >> $GITHUB_OUTPUT
1911
- name: Set up JDK
20-
if: steps.check_head_of_main.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref
12+
if: github.ref == 'refs/heads/main'
2113
uses: actions/setup-java@v4
2214
with:
2315
distribution: temurin
2416
java-version: 21
2517
- name: Set up SBT
26-
if: steps.check_head_of_master.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref
18+
if: github.ref == 'refs/heads/main'
2719
uses: sbt/setup-sbt@v1.1.16
2820
with:
2921
sbt-runner-version: 1.10.11
3022
- name: Build and release
31-
if: steps.check_head_of_master.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref
23+
if: github.ref == 'refs/heads/main'
3224
env:
3325
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
3426
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

0 commit comments

Comments
 (0)