.github/workflows/gradle.yml #462
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
on: [push, pull_request, create] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 8 | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Execute tests | |
run: ./gradlew check || (exitcode=$?; find build/tests -name '*.log' -type f | while read f; do echo -e "\033[4m$f\033[0m"; cat $f; done && return $exitcode) | |
- name: Build deployment artifacts | |
run: ./gradlew deploy | |
- name: Upload jars as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: software-challenge-backend-${{ github.sha }} | |
path: | | |
build/deploy/*.zip | |
build/deploy/*.jar | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: software-challenge-backend-${{ github.sha }} | |
path: artifacts | |
- name: Release ${{ github.ref }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: artifacts/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |