Merge branch 'master' into release

This commit is contained in:
Titan Yuan
2024-09-28 16:52:27 -07:00
4 changed files with 122 additions and 18 deletions

View File

@@ -1,12 +1,14 @@
name: Build project
name: Build
on:
push:
branches:
- release
pull_request:
branches:
- release
push:
branches:
- release
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- release
jobs:
buildForAllSupportedPlatforms:
@@ -36,13 +38,20 @@ 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 777 build/${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v4
- if: matrix.targetPlatform == 'StandaloneWindows64'
run: cd build/${{ matrix.targetPlatform }} && sudo zip -r ../build-${{ matrix.targetPlatform }}.zip * && cd -
- if: matrix.targetPlatform == 'StandaloneWindows64'
uses: actions/upload-artifact@v4
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
path: build/build-${{ matrix.targetPlatform }}.zip
- if: matrix.targetPlatform == 'StandaloneOSX'
run: sudo tar -czvf build/build-${{ matrix.targetPlatform }}.tar.gz -C build/${{ matrix.targetPlatform }} .
- if: matrix.targetPlatform == 'StandaloneOSX'
uses: actions/upload-artifact@v4
with:
name: Build-${{ matrix.targetPlatform }}
path: build/build-${{ matrix.targetPlatform }}.tar.gz

55
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: Release
on:
workflow_run:
workflows: [Build]
types: [completed]
branches-ignore:
- release
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
- uses: actions/download-artifact@v4
with:
path: build
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- 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/build-StandaloneWindows64.zip
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.tar.gz
asset_path: build/build-StandaloneOSX.tar.gz
asset_content_type: application/gzip