Merge pull request #58 from sweetrpg/feature/configurable-costs #97
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: CI | |
on: | |
push: | |
branches: [ "1.18", "1.19", "1.20" ] | |
paths: | |
- 'src/**' | |
- 'test/**' | |
- build.gradle | |
- gradle.properties | |
- settings.gradle | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version-file: .java-version | |
distribution: 'temurin' | |
- id: get_last_version | |
name: Get last version | |
run: | | |
echo "latest_version=$(cat .release-info/${{ github.ref_name }}/VERSION)" >> $GITHUB_ENV | |
- id: get_bump_level | |
name: Get bump level | |
run: | | |
echo "bump_level=$(cat .release-info/${{ github.ref_name }}/BUMP_LEVEL)" >> $GITHUB_ENV | |
- id: bump_version | |
name: Bump version | |
uses: cbrgm/semver-bump-action@main | |
with: | |
current-version: ${{ env.latest_version }} | |
bump-level: ${{ env.bump_level || 'patch' }} | |
- id: reset_bump_level | |
name: Reset bump level | |
run: | | |
echo "patch" > .release-info/${{ github.ref_name }}/BUMP_LEVEL | |
- name: Wrapper validation | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build and test | |
env: | |
MOD_VERSION: "${{ steps.bump_version.outputs.new_version }}" | |
run: | | |
./gradlew build test --console=verbose | |
- name: Commit version file | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "SweetRPG CI" | |
echo "${{ steps.bump_version.outputs.new_version }}" > .release-info/${{ github.ref_name }}/VERSION | |
git add .release-info/${{ github.ref_name }}/* | |
git commit -m "Update ${{ github.ref_name }} .release-info files" | |
git push origin | |
- name: Release artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: "${{ github.ref_name }}-${{ steps.bump_version.outputs.new_version }}" | |
prerelease: true | |
files: | | |
build/libs/*.jar |