From ea3ba51494c3d411e2c411492fcd6f6baf855dfd Mon Sep 17 00:00:00 2001 From: Titan Yuan Date: Fri, 27 Sep 2024 18:01:17 -0700 Subject: [PATCH] Add release action --- .../workflows/{builder.yaml => build.yaml} | 17 +++---- .github/workflows/release.yaml | 51 +++++++++++++++++++ README.md | 4 ++ RELEASE.md | 27 ++++++++++ 4 files changed, 89 insertions(+), 10 deletions(-) rename .github/workflows/{builder.yaml => build.yaml} (80%) create mode 100644 .github/workflows/release.yaml create mode 100644 RELEASE.md diff --git a/.github/workflows/builder.yaml b/.github/workflows/build.yaml similarity index 80% rename from .github/workflows/builder.yaml rename to .github/workflows/build.yaml index e3c61903..9af6ee10 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/build.yaml @@ -1,12 +1,9 @@ -name: Build project +name: Build on: - push: - branches: - - release - pull_request: - branches: - - release + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' jobs: buildForAllSupportedPlatforms: @@ -36,13 +33,13 @@ jobs: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} with: - buildName: micromissiles-${{ github.run_number }}-${{ matrix.targetPlatform }} + buildName: micromissiles-${{ github.ref_name }}-${{ matrix.targetPlatform }} versioning: Semantic targetPlatform: ${{ matrix.targetPlatform }} - name: Make build output readable and executable run: | sudo chmod -R +rx build/${{ matrix.targetPlatform }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Build-${{ matrix.targetPlatform }} - path: build/${{ matrix.targetPlatform }} \ No newline at end of file + path: build/${{ matrix.targetPlatform }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..d5899a1f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,51 @@ +name: Release + +on: + workflow_run: + workflows: [Build] + types: [completed] + push: + tags: v[0-9]+.[0-9]+.[0-9]+ + +jobs: + release: + name: Create release + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + fetch-depth: 0 + lfs: false + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.workflow_run.head_branch }} + release_name: ${{ github.event.workflow_run.head_branch }} + body_path: RELEASE.md + draft: false + prerelease: false + - run: ls -la build/* + - run: ls -la build/StandaloneOSX/* + - name: Upload Windows release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: micromissiles-${{ github.event.workflow_run.head_branch }}-windows_x86_64.zip + asset_path: build/StandaloneWindows64/Build-StandaloneWindows64 + asset_content_type: application/zip + - name: Upload Darwin release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: micromissiles-${{ github.event.workflow_run.head_branch }}-darwin.zip + asset_path: build/StandaloneOSX/Build-StandaloneOSX + asset_content_type: application/zip diff --git a/README.md b/README.md index ba0798ce..bc57e21a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ You can find the latest release [here](https://github.com/PisterLab/micromissile ## Windows +1. Download the zip file for Windows: `micromissiles--windows_x86_64.zip`. +2. Unzip the zip file. The zip file should contain a single directory called `micromissiles--windows_x86_64`. +3. Run `micromissiles--StandaloneWindows64.exe`. + ## Mac 1. Download the zip file for Darwin: `micromissiles--darwin.zip`. diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..0fe4cb93 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,27 @@ +# micromissiles-unity + +## Build ${{ github.event.workflow_run.head_branch }} + +## Instructions + +Download and extract the archive corresponding to your platform (Windows or Mac) from the binaries listed below. + +## Windows + +1. Download the zip file for Windows: `micromissiles-${{ github.event.workflow_run.head_branch }}-windows_x86_64.zip`. +2. Unzip the zip file. The zip file should contain a single directory called `micromissiles-${{ github.event.workflow_run.head_branch }}-windows_x86_64`. +3. Run `micromissiles--StandaloneWindows64.exe`. + +## Mac + +1. Download the zip file for Darwin: `micromissiles-${{ github.event.workflow_run.head_branch }}-darwin.zip`. +2. Unzip the zip file. The zip file should contain a single app file. +3. Change the permission of the app file recursively by running: + ```bash + chmod -R +x micromissiles--StandaloneOSX.app + ``` +4. Open the app file. +5. If you get a warning that Apple cannot check the application for malicious software: + * Open `System Preferences`. + * Navigate to `Privacy & Security`. + * Click on `Open Anyway` to bypass Apple's developer check.