From 2f62b432485624bc229e0830d173427d772878d2 Mon Sep 17 00:00:00 2001 From: Gaelmare <2gaelmare@gmail.com> Date: Sun, 24 Sep 2023 00:49:37 -0600 Subject: [PATCH] Testing GitHub workflows --- .github/workflows/main.yml | 84 ++++++++++++++++++++++++++++++++++++++ build.gradle | 2 +- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..93244fb --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,84 @@ +name: Build + +on: + push: + tags: + - 'v*' + +env: + + PROJECT_ID: "362368" + +permissions: + contents: write + +jobs: + main: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' + - name: Get Version + id: version + uses: actions/github-script@0.4.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + let ref = '${{ github.ref }}'; + return ref.startsWith('refs/tags/v') ? ref.replace('refs/tags/v', '') : 'indev'; + - name: Get Version Type + id: version_type + uses: actions/github-script@0.4.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + let version = '${{ steps.version.outputs.result }}'; + return version.includes('alpha') ? 'alpha' : (version.includes('beta') ? 'beta' : (version == 'indev' ? 'indev' : 'release')); + - name: Log Version Info + env: + VERSION: ${{ steps.version.outputs.result }} + VERSION_TYPE: ${{ steps.version_type.outputs.result }} + run: echo "version = $VERSION, type = $VERSION_TYPE" + - name: Build + uses: gradle/gradle-build-action@v2 + with: + arguments: build + env: + VERSION: ${{ steps.version.outputs.result }} + - name: Create Release + id: create_release + if: ${{ steps.version.outputs.result != 'indev' && success() }} + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.version.outputs.result }} + release_name: DynamicTrees TFC v${{ steps.version.outputs.result }} + body: | + Version ${{ steps.version.outputs.result }} + + ### Changes + + - todo: document changes + draft: true + prerelease: ${{ steps.version_type.outputs.result != 'release' }} + - name: Upload Main Jar + id: upload_main_jar + if: ${{ steps.version.outputs.result != 'indev' && success() }} + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/libs/dttfc-${{ steps.version.outputs.result }}.jar + asset_name: dttfc-${{ steps.version.outputs.result }}.jar + asset_content_type: application/java-archive \ No newline at end of file diff --git a/build.gradle b/build.gradle index de7e537..8d014c0 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'org.spongepowered.mixin' -version = '1.18.2-1.0.0-rc3' +version = '1.18.2-1.0.0-alpha3' group = 'org.labellum.mc' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'dttfc'