Merge pull request #1654 from chsami/development #408
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest # You can choose a different runner if needed | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: 11 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| gradle-version: wrapper | |
| - name: Build Shaded JAR | |
| run: | | |
| COMMIT_SHA=$(git rev-parse --short HEAD) | |
| ./gradlew :client:shadowJar -Pmicrobot.commit.sha=$COMMIT_SHA | |
| - name: Read microbot.version from Gradle | |
| id: version | |
| run: | | |
| V=$(./gradlew -q properties --console=plain | sed -n 's/^microbot.version: //p') | |
| if [ -z "$V" ]; then V=$(grep '^microbot.version=' gradle.properties | cut -d= -f2); fi | |
| echo "version=$V" >> "$GITHUB_OUTPUT" | |
| echo "Using version: $V" | |
| - name: Prepare artifact name | |
| run: | | |
| SRC=$(echo runelite-client/build/libs/client-*-shaded.jar) | |
| DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar | |
| cp "$SRC" "$DEST" | |
| - name: Create Release | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: "${{ steps.version.outputs.version }}" | |
| prerelease: false | |
| title: "Release ${{ steps.version.outputs.version }}" | |
| files: | | |
| /home/runner/work/Microbot/Microbot/runelite-client/build/libs/microbot-*.jar | |
| - name: Upload Jar to Hetzner | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.PROD_HOST }} | |
| username: root | |
| key: ${{ secrets.PROD_SSH_KEY }} | |
| source: runelite-client/build/libs/microbot-*.jar | |
| target: /var/www/files/releases/microbot/stable/ | |
| strip_components: 3 | |
| - name: Get Auth Token | |
| id: auth | |
| run: | | |
| RESPONSE=$(curl -X POST \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"email\":\"${{ secrets.API_EMAIL }}\",\"password\":\"${{ secrets.API_PASSWORD }}\"}" \ | |
| https://microbot.cloud/api/auth/login) | |
| TOKEN=$(echo $RESPONSE | jq -r '.token') | |
| echo "token=$TOKEN" >> "$GITHUB_OUTPUT" | |
| - name: Update API Version | |
| run: | | |
| curl -X PUT \ | |
| -H "Authorization: Bearer ${{ steps.auth.outputs.token }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"version\":\"${{ steps.version.outputs.version }}\"}" \ | |
| https://microbot.cloud/api/version/client |