From b65626c1bcfcace6ee6a5a9d9ae5c029372ee545 Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Fri, 5 Aug 2022 13:17:27 -0700 Subject: [PATCH] Attempt to make automated polymart beta releases --- .github/workflows/prerelease.yml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/prerelease.yml diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..4bd4d30 --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,44 @@ +name: Deploy Pre-Release to Polymart + +on: + push: + branches: + - dev + + +jobs: + build: + runs-on: ubuntu-latest + environment: polymart_deploy + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + - name: Change version to include build + run: | + - export OLD_VERSION=`cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}'` + - export NEW_VERSION=`$OLD_VERSION-b${{github.run_number}}` + - sed -i 's/$OLD_VERION/$NEW_VERSION/' build.gradle.kts + - echo Version number is now $(cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}') + - name: Build with Gradle + uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7 + with: + arguments: :free:shadowJar :premium:shadowJar + - name: Upload build files artifact + uses: actions/upload-artifact@v2.3.1 + with: + # Artifact name + name: build-files + # A file, directory or wildcard pattern that describes what to upload + path: '*/build/*' + # The desired behavior if no files are found using the provided path. + if-no-files-found: error + retention-days: 2 + - name: Deploy to Polymart + env: + POLYMART_TOKEN: ${{ secrets.POLYMART_TOKEN }} + run: | + - curl -F "file=@free/build/libs/ajQueue-$UPDATE_VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2535" -F version="$NEW_VERSION" -F title="Pre-release v$NEW_VERSION" -F beta=1 -F message="Note: This is a (most likely) un-tested build. It is not guarenteed to work!\n\n${{ github.event.head_commit.message }}" "https://api.polymart.org/v1/postUpdate"