Run build #45
Workflow file for this run
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: Run build | |
on: | |
workflow_dispatch: {} | |
push: | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
types: [opened, synchronize, reopened] | |
jobs: | |
check-branch: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' # PRイベントの場合にのみ実行 | |
steps: | |
- name: Check PR branch | |
run: | | |
echo "The source branch for this PR is: ${{ github.head_ref }}" | |
if [[ "${{ github.head_ref }}" == "develop" ]]; then | |
echo "This PR is from the 'develop' branch. Proceeding with build." | |
else | |
echo "This PR is from the '${{ github.head_ref }}' branch. Non-develop branches are allowed." | |
fi | |
build: | |
name: Run builds for Windows, Mac | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: | |
- StandaloneWindows64 | |
- StandaloneOSX | |
unityVersion: ['6000.0.31f1'] | |
include: | |
- targetPlatform: StandaloneWindows64 | |
runsOn: windows-latest | |
modules: windows-il2cpp | |
- targetPlatform: StandaloneOSX | |
runsOn: macos-latest | |
modules: mac-il2cpp | |
runs-on: ${{ matrix.runsOn }} | |
steps: | |
- name: Check out my unity project. | |
uses: actions/[email protected] | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/[email protected] | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
- name: Set outputs | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- uses: actions/[email protected] | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: Run the build for ${{ matrix.targetPlatform }} | |
uses: game-ci/[email protected] | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
with: | |
targetPlatform: ${{ matrix.targetPlatform }} | |
unityVersion: ${{ matrix.unityVersion }} | |
- name: Upload the Build for ${{ matrix.targetPlatform }} | |
if: matrix.targetPlatform == 'StandaloneOSX' | |
uses: actions/[email protected] | |
with: | |
name: Build-${{ matrix.targetPlatform }}-${{ steps.vars.outputs.sha_short }} | |
path: build | |
- name: Commit version and config files | |
if: matrix.targetPlatform == 'StandaloneWindows64' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add version.txt inno_setup_config.txt | |
git commit -m "Update version and config files after build" | |
git push origin HEAD:${{ github.ref }} | |
- name: Read version.txt | |
if: matrix.targetPlatform == 'StandaloneWindows64' | |
id: get_version | |
run: | | |
$VERSION = Get-Content "version.txt" | |
echo "app_version=$VERSION" >> $GITHUB_ENV | |
echo "アプリのバージョン: $VERSION" | |
- name: Set up Inno Setup | |
if: matrix.targetPlatform == 'StandaloneWindows64' | |
uses: Minionguyjpro/[email protected] | |
with: | |
path: 'setup.iss' | |
- name: Upload Installer | |
if: matrix.targetPlatform == 'StandaloneWindows64' | |
uses: actions/[email protected] | |
with: | |
name: uDesktopMascot_win64_${{ env.app_version }} | |
path: "build/uDesktopMascot_win64_${{ env.app_version }}.exe" |