GitHub Actions: run if tags are pushed

This commit is contained in:
Karl Tauber
2020-11-21 13:38:21 +01:00
parent 4d5242cd61
commit f8c7ccf064
2 changed files with 53 additions and 44 deletions

View File

@@ -4,9 +4,13 @@ name: CI
on: on:
push: push:
branches: [github-actions] branches:
- github-actions
tags:
- '[0-9]*'
pull_request: pull_request:
branches: [github-actions] branches:
- github-actions
jobs: jobs:
build: build:
@@ -18,53 +22,58 @@ jobs:
# - Java 1.8 (minimum requirement) # - Java 1.8 (minimum requirement)
# - Java 9 (first version with JPMS) # - Java 9 (first version with JPMS)
# - Java LTS versions (11, 17, ...) # - Java LTS versions (11, 17, ...)
# - last two Java versions # - lastest Java version(s)
java: [1.8, 9, 11, 14, 15] java:
- 1.8
- 9
- 14
- 15
- 11 # always last because used to build snapshots and releases
steps: steps:
- name: info - name: info
run: | run: |
echo ${{ matrix.java }} echo ${{ matrix.java }}
echo ${{ github.event_name }} echo ${{ github.event_name }}
echo ${{ github.ref }} echo ${{ github.ref }}
echo ${{ github.repository }} echo ${{ github.repository }}
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Java ${{ matrix.java }} - name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
- name: Cache Gradle wrapper - name: Cache Gradle wrapper
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/.gradle/wrapper path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache - name: Cache Gradle cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/.gradle/caches path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle restore-keys: ${{ runner.os }}-gradle
- name: Build with Gradle - name: Build with Gradle
run: echo ./gradlew build run: echo ./gradlew build
- name: Publish snapshot to oss.jfrog.org - name: Publish snapshot to oss.jfrog.org
run: echo ./gradlew artifactoryPublish run: echo ./gradlew artifactoryPublish
if: | if: |
matrix.java == '11' && 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 - name: Release a new stable version to bintray
run: echo ./gradlew bintrayUpload -Drelease=true run: echo ./gradlew bintrayUpload -Drelease=true
if: | if: |
matrix.java == '11' && 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'

View File

@@ -25,8 +25,8 @@ stages:
if: branch = disabled if: branch = disabled
- name: snapshot - name: snapshot
if: branch = disabled AND type IN (push) AND tag IS blank if: branch = disabled AND type IN (push) AND tag IS blank
- name: release # - name: release
if: type IN (push) AND tag IS present # if: type IN (push) AND tag IS present
jobs: jobs:
include: include: