Split gradle.yml to 2 workflows, one for push to master, other for pu… #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Generate jar file when tag pushed | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
# This tests if the build, checkstyle and jUnit tests pass, then | |
testAndGenerateReleaseFile: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: run checkstyle | |
run: ./gradlew checkstyleTest checkstyleMain | |
- name: run gradle test | |
run: ./gradlew test | |
- name: build Jar file | |
run: ./gradlew shadowJar | |
- name: Release Jar file | |
uses: phuonghuynh/action-ghrelease@v1.1.0 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
# Note-worthy description of changes in release | |
body: This release is automated with github actions. | |
# body_path: ${{ github.workspace }}-CHANGELOG.txt | |
# Gives the release a custom name. Defaults to tag name | |
name: (${{github.ref_name}}) New Jar File Release! | |
# Newline-delimited list of path globs for asset files to upload | |
files: ./build/libs/yappingbot.jar |