Skip to content

deps: Bump spotbugs from 5.1.1 to 5.1.2 #118

deps: Bump spotbugs from 5.1.1 to 5.1.2

deps: Bump spotbugs from 5.1.1 to 5.1.2 #118

Workflow file for this run

name: Build, Test, and Release
on:
push:
branches:
- 'main'
tags:
- 'v*' # For v1.0, v0.1.0, etc
pull_request:
branches:
- 'main'
schedule:
- cron: '0 0 * * 6'
workflow_dispatch:
concurrency:
# Allow concurrent run for main, MR, and tag
# Disallow concurrent runs on same MRs, tags, and main (triggered by dispatch, schedule, or push)
group: ${{ format('{0}-{1}', github.job, github.ref) }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
java: [ 17 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Grant execute permission for gradlew
if: runner.os == 'Linux'
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assemble --info
- name: Upload build results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }} Java ${{ matrix.java }} build results
path: ${{ github.workspace }}/build/libs/
test:
name: Run unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
java: [ 17 ]
needs:
- build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Grant execute permission for gradlew
if: runner.os == 'Linux'
run: chmod +x gradlew
- name: Test with Gradle
run: ./gradlew check --debug
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }} Java ${{ matrix.java }} test results
path: ${{ github.workspace }}/build/reports/
release:
needs:
- build
- test
runs-on: ubuntu-latest
if: github.ref_type == 'tag' || (github.ref_name == 'main' && github.event_name != 'schedule')
steps:
- name: Set snapshot environment
if: github.ref_name == 'main'
run: |
echo "RELEASE_TAG=0.0.0-RC-1" >> $GITHUB_ENV
- name: Set release environment
if: github.ref_type == 'tag'
run: |
echo "RELEASE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish with Gradle
run: ./gradlew -Pver=${{ env.RELEASE_TAG }} release
- name: Create Release
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
files: ${{ github.workspace }}/build/libs/*
generate_release_notes: true
name: ${{ format('Release {0}', github.ref_name) }}
prerelease: ${{ contains(github.ref_name, '-rc-') }}
fail_on_unmatched_files: true
draft: true
notify:
name: Send job complete notification
runs-on: ubuntu-latest
needs:
- build
- test
- release
# Run if on main or tag
if: always() && (github.ref_name == 'main' || github.ref_type == 'tag')
steps:
- name: Set snapshot environment
if: github.ref_name == 'main'
run: |
echo "RELEASE_TYPE=snapshot" >> $GITHUB_ENV
echo "RELEASE_ADDR=https://github.com/CrimsonWarpedcraft/plugin-template/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
- name: Set release environment
if: github.ref_type == 'tag'
run: |
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
echo "RELEASE_ADDR=https://github.com/CrimsonWarpedcraft/plugin-template/releases/tag/${{ github.ref_name }}" >> $GITHUB_ENV
- name: Notify on success
if: needs.build.result == 'success' && needs.test.result == 'success' && (needs.release.result == 'success' || github.event_name == 'schedule')
uses: appleboy/[email protected]
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: "#00FF00"
username: "ExamplePlugin Release Bot"
message: >
An ExamplePlugin ${{ env.RELEASE_TYPE }} was deployed:
${{ env.RELEASE_ADDR }}
- name: Notify on failure
if: needs.build.result == 'failure' || needs.test.result == 'failure' || needs.release.result == 'failure'
uses: appleboy/[email protected]
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: "#FF0000"
username: "ExamplePlugin Release Bot"
message: >
An ExamplePlugin ${{ env.RELEASE_TYPE }} failed:
https://github.com/CrimsonWarpedcraft/plugin-template/actions/runs/${{ github.run_id }}