Release #39
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: Release | |
on: workflow_dispatch | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
release: ${{ steps.tag.outputs.release }} | |
version: ${{ steps.tag.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog | |
uses: TriPSs/conventional-changelog-action@v3 | |
id: changelog | |
with: | |
git-push: false | |
output-file: false | |
skip-git-pull: true | |
skip-version-file: true | |
skip-commit: true | |
skip-tag: true | |
- name: Create release | |
id: tag | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
script: | | |
const skipped = '${{ steps.changelog.outputs.skipped }}'; | |
const tag = '${{ steps.changelog.outputs.tag }}'; | |
const version = '${{ steps.changelog.outputs.version }}'; | |
const body = `${{ steps.changelog.outputs.clean_changelog }}`; | |
if (skipped !== 'false') { | |
core.setFailed('No changes to publish.'); | |
return; | |
} | |
const release = await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: tag, | |
name: tag, | |
body, | |
}); | |
core.setOutput('version', version); | |
core.setOutput('release', release.data.id); | |
fmod: | |
name: Build FMOD | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- uses: ./.github/actions/fmod | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: FMOD Build | |
path: .fmod/Build | |
build: | |
name: ${{ matrix.mode }} for ${{ matrix.targetPlatform }} | |
needs: [ release, fmod ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
targetPlatform: | |
- StandaloneWindows64 | |
- StandaloneLinux64 | |
- StandaloneOSX | |
mode: [ Build ] | |
include: | |
- targetPlatform: StandaloneWindows64 | |
method: Editor.BuildScript.Build | |
mode: Dev | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ matrix.targetPlatform }} | |
restore-keys: Library- | |
- uses: actions/download-artifact@v3 | |
with: | |
name: FMOD Build | |
path: .fmod/Build | |
- uses: game-ci/unity-builder@v2 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
gitPrivateToken: ${{ secrets.PACKAGES_TOKEN }} | |
unityVersion: 2022.3.6f1 | |
targetPlatform: ${{ matrix.targetPlatform }} | |
versioning: Custom | |
version: ${{ needs.release.outputs.version }} | |
buildMethod: ${{ matrix.method }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.mode }}-${{ matrix.targetPlatform }} | |
path: build/${{ matrix.targetPlatform }} | |
- name: Create zip archive | |
run: | | |
cd build/${{ matrix.targetPlatform }} | |
zip -r ../../artifact.zip . | |
- name: Upload asset | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const release_id = `${{ needs.release.outputs.release }}`; | |
const name = `${{ matrix.mode }}-${{ matrix.targetPlatform }}.zip`; | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id, | |
name, | |
data: require("fs").readFileSync("artifact.zip"), | |
}); | |
steam: | |
name: Deploy to Steam | |
needs: [ release, build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download StandaloneWindows64 Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Build-StandaloneWindows64 | |
path: build/StandaloneWindows64 | |
- name: Download StandaloneLinux64 Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Build-StandaloneLinux64 | |
path: build/StandaloneLinux64 | |
- name: Download StandaloneOSX Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Build-StandaloneOSX | |
path: build/StandaloneOSX | |
- uses: game-ci/steam-deploy@v3 | |
with: | |
username: ${{ secrets.STEAM_USERNAME }} | |
configVdf: ${{ secrets.STEAM_CONFIG_VDF}} | |
appId: ${{ secrets.STEAM_APP_ID }} | |
buildDescription: v${{ needs.release.outputs.version }} | |
rootPath: build | |
depot1Path: StandaloneWindows64 | |
depot2Path: StandaloneLinux64 | |
depot3Path: StandaloneOSX | |
releaseBranch: prerelease |