From 85608f51fdbf4005fe2eebcc346d209a03043b60 Mon Sep 17 00:00:00 2001 From: Thierry Lacour Date: Thu, 15 Jul 2021 16:19:28 +0200 Subject: [PATCH] Set up basic publishing workflow Revamps the GitHub Actions workflows to the following: **build.yml** Verifies pull requests and commits to main. Archives debug/release builds for them respectively. **publish.yml** On tag, downloads the relevant release build and publishes it as a GitHub Release. Fixes #18 --- .github/workflows/build.yml | 61 ++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 35 +++++++++++++++++ .github/workflows/verification.yml | 32 ---------------- 3 files changed, 96 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/verification.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e60d0c8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + platform: [ linux, windows, mac ] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + lfs: true + + - name: Run GUT tests + uses: josephbmanley/run-gut-tests-action@v1.1.0 + + - name: Decide debugMode + uses: haya14busa/action-cond@v1 + id: debugMode + with: + cond: ${{ github.event_name == 'pull_request' }} + if_true: "true" + if_false: "false" + + - name: Build game client + id: build + uses: josephbmanley/build-godot-action@v1.4.1 + with: + name: NeoMori + preset: ${{ matrix.platform }} + debugMode: ${{ steps.debugMode.outputs.value }} + + - name: Upload build + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.platform }} + path: ${{ github.workspace }}/build/* + + - name: Git describe + run: echo "GIT_DESCRIBE=$(git describe)" >> $GITHUB_ENV + + - name: Create override.cfg + if: ${{ env.GIT_DESCRIBE != '' }} + run: echo "global/version = $GIT_DESCRIBE" > override.cfg + + - name: Upload override.cfg + if: ${{ env.GIT_DESCRIBE != '' }} + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.platform }} + path: ${{ github.workspace }}/override.cfg diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..4cbb636 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + + strategy: + matrix: + platform: [ linux, windows, mac ] + + steps: + - name: Download client + uses: dawidd6/action-download-artifact@v2 + with: + workflow: build.yml + workflow_conclusion: success + commit: ${{ github.sha }} + event: push + name: ${{ matrix.platform }} + path: NeoMori + + - name: Zip client + run: zip -q -r ${{ matrix.platform }}.zip NeoMori + + - name: Publish clients + uses: softprops/action-gh-release@v1 + with: + files: ${{ matrix.platform }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml deleted file mode 100644 index 8f3ba61..0000000 --- a/.github/workflows/verification.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Verification - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - platform: [linux, windows, mac] - steps: - - uses: actions/checkout@v2 - with: - lfs: true - - name: Build - id: build - uses: josephbmanley/build-godot-action@v1.4.1 - with: - name: example - preset: ${{ matrix.platform }} - debugMode: "true" - - uses: josephbmanley/run-gut-tests-action@v1.0.1 - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - name: Client - ${{ matrix.platform }} - path: ${{ github.workspace }}/${{ steps.build.outputs.build }}