v146 #1509
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
name: Java Tests # Tests and pushes to unstable | |
on: | |
push: | |
branches: "**" # Runs on all branches but never on tags | |
workflow_dispatch: # Manual trigger | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Commit | |
uses: actions/checkout@v2 | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 20 | |
distribution: temurin | |
- name: Setup Gradle Caching | |
uses: gradle/[email protected] | |
- name: Set Env | |
run: echo "SLUG=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Timestamp | |
id: time | |
uses: 1466587594/get-current-time@v2 | |
with: | |
format: "[${{env.SLUG}}], MMM. D, YYYY [Unstable]" # Pulls the tag name and current date to produce clientVersion > v1.0.0, Jan. 1, 1970 | |
- name: Run Tests | |
run: ./gradlew tests:cleanTest tools:pack tests:test desktop:dist -PupdateUrl=mindustry-antigrief/mindustry-client-v7-builds -PassetUrl=mindustry-antigrief/mindustry-client -PassetRef=${{ env.SLUG }} -PclientVersion="${{ steps.time.outputs.formattedTime }}" --parallel | |
- name: Create Release | |
if: ${{ github.repository == 'mindustry-antigrief/mindustry-client' && github.ref == 'refs/heads/v7' }} | |
id: create_release_v7 | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
body: | | |
Foo's Client Unstable ${{ github.run_number }} [(${{ env.SLUG }})](https://github.com/mindustry-antigrief/mindustry-client/commit/${{ github.sha }}) | |
Steam installation instructions [here](../../../mindustry-client/tree/v7#steam) | |
**Commit Message:** | |
*${{ github.event.head_commit.message }}* | |
commitish: main | |
tag_name: ${{ github.run_number }} | |
release_name: ${{ steps.time.outputs.formattedTime }} | |
repo: mindustry-client-v7-builds | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
if: ${{ github.repository == 'mindustry-antigrief/mindustry-client' && github.ref == 'refs/heads/v7' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release_v7.outputs.upload_url }} | |
asset_path: desktop/build/libs/Mindustry.jar | |
asset_name: desktop.jar | |
asset_content_type: application/zip | |
- name: Add Audio To Jar | |
if: ${{ github.repository == 'mindustry-antigrief/mindustry-client' && github.ref == 'refs/heads/v7' }} | |
run: jar uf desktop/build/libs/Mindustry.jar -C core/assets sounds -C core/assets music | |
- name: Upload Release Asset With Audio | |
if: ${{ github.repository == 'mindustry-antigrief/mindustry-client' && github.ref == 'refs/heads/v7' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release_v7.outputs.upload_url }} | |
asset_path: desktop/build/libs/Mindustry.jar | |
asset_name: desktopWithAudio.jar | |
asset_content_type: application/zip | |
- name: Upload Artifact (No release was made) | |
if: ${{ !(github.repository == 'mindustry-antigrief/mindustry-client' && (github.ref == 'refs/heads/v6' || github.ref == 'refs/heads/v7' || github.event_name == 'workflow_dispatch')) }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Desktop JAR (zipped) | |
path: desktop/build/libs/Mindustry.jar | |
- name: Upload Test Results To Pages | |
if: ${{ !cancelled() && github.repository == 'mindustry-antigrief/mindustry-client' && (github.ref == 'refs/heads/v7' || github.event_name == 'workflow_dispatch') }} | |
uses: JamesIves/[email protected] | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
repository-name: ${{ github.repository }}-v7-builds | |
branch: gh-pages # The branch the action should deploy to. | |
folder: tests/build/reports/tests/test | |
silent: true | |
single-commit: true |