GitHub Actions: use separate jobs for snapshots and releases to be sure that build succeeded for all Java versions

This commit is contained in:
Karl Tauber
2020-11-21 14:04:32 +01:00
parent f8c7ccf064
commit a1f78345e6

View File

@@ -26,19 +26,11 @@ jobs:
java: java:
- 1.8 - 1.8
- 9 - 9
- 11 # LTS
- 14 - 14
- 15 - 15
- 11 # always last because used to build snapshots and releases
steps: steps:
- name: info
run: |
echo ${{ matrix.java }}
echo ${{ github.event_name }}
echo ${{ github.ref }}
echo ${{ github.repository }}
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Java ${{ matrix.java }} - name: Setup Java ${{ matrix.java }}
@@ -62,18 +54,68 @@ jobs:
- name: Build with Gradle - name: Build with Gradle
run: echo ./gradlew build run: echo ./gradlew build
- name: Publish snapshot to oss.jfrog.org
run: echo ./gradlew artifactoryPublish snapshot:
runs-on: ubuntu-latest
needs: build
if: | if: |
matrix.java == '11' &&
github.event_name == 'push' && github.event_name == 'push' &&
github.ref == 'refs/heads/github-actions' && github.ref == 'refs/heads/github-actions' &&
github.repository == 'JFormDesigner/FlatLaf' github.repository == 'JFormDesigner/FlatLaf'
- name: Release a new stable version to bintray steps:
run: echo ./gradlew bintrayUpload -Drelease=true - uses: actions/checkout@v2
- name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
- name: Publish snapshot to oss.jfrog.org
run: echo ./gradlew artifactoryPublish
release:
runs-on: ubuntu-latest
needs: build
if: | if: |
matrix.java == '11' &&
github.event_name == 'push' && github.event_name == 'push' &&
startsWith( github.ref, 'refs/tags/' ) && startsWith( github.ref, 'refs/tags/' ) &&
github.repository == 'JFormDesigner/FlatLaf' github.repository == 'JFormDesigner/FlatLaf'
steps:
- uses: actions/checkout@v2
- name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
- name: Release a new stable version to bintray
run: echo ./gradlew bintrayUpload -Drelease=true