v1.124 #1639
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: Test, Build, and Deploy with GameCI | |
concurrency: unity | |
env: | |
UNITY_VERSION: 6000.0.30f1 | |
on: | |
push: | |
branches: | |
- develop | |
paths: | |
- 'Assets/**' | |
- 'Packages/**' | |
- 'ProjectSettings/**' | |
pull_request: | |
types: | |
- opened | |
branches: | |
- main | |
paths: | |
- 'Assets/**' | |
- 'Packages/**' | |
- 'ProjectSettings/**' | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
inputs: | |
workflow_mode: | |
description: '[release] [Android, iOS, StandaloneLinux64, WebGL, StandaloneWindows64, WSAPlayer, StandaloneOSX, Steam]' | |
required: false | |
default: '' | |
jobs: | |
tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
contents: write | |
steps: | |
- name: Pre-pull Unity Docker image | |
run: | | |
docker pull unityci/editor:${{ env.UNITY_VERSION }}-linux-il2cpp-3 & | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
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: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-test-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: Library-test- | |
- name: Run Unit Tests | |
uses: game-ci/unity-test-runner@main | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
with: | |
testMode: playmode | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update Release Notes | |
if: github.event.action == 'published' | |
env: | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: | | |
echo "$RELEASE_NOTES" > fastlane/metadata/android/en-US/changelogs/default.txt | |
echo "$RELEASE_NOTES" > fastlane/metadata/en-US/release_notes.txt | |
- name: Auto-Commit Release Notes | |
if: github.event.action == 'published' | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: main | |
file_pattern: fastlane/metadata | |
commit_message: Update Release Notes (MINOR) | |
lint: | |
name: Quality Check | |
runs-on: ubuntu-latest | |
container: unityci/editor:ubuntu-6000.0.30f1-linux-il2cpp-3 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v1 | |
with: | |
lfs: true | |
- name: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-lint-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: Library-lint- | |
- name: Activate Unity | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
run: unity-editor -nographics -logFile /dev/stdout -quit -username "$UNITY_EMAIL" -password "$UNITY_PASSWORD" -serial "$UNITY_SERIAL" | |
- name: Generate Solution | |
run: unity-editor -nographics -logFile /dev/stdout -customBuildName Card-Game-Simulator -projectPath . -executeMethod Packages.Rider.Editor.RiderScriptEditor.SyncSolution -quit | |
- name: Return License | |
if: always() | |
continue-on-error: true | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
run: unity-editor -quit -batchmode -returnlicense -username "$UNITY_EMAIL" -password "$UNITY_PASSWORD" -serial "$UNITY_SERIAL" | |
- name: SonarQube Analysis | |
env: | |
FrameworkPathOverride: /opt/unity/Editor/Data/MonoBleedingEdge/ | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sed -i 's/<ReferenceOutputAssembly>false<\/ReferenceOutputAssembly>/<ReferenceOutputAssembly>true<\/ReferenceOutputAssembly>/g' *.csproj | |
sed -i 's/\([A-Za-z0-9.-]\+csproj\)/Card-Game-Simulator\/&/g' Card-Game-Simulator.sln | |
mv Card-Game-Simulator.sln .. | |
cd .. | |
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh | |
chmod +x ./dotnet-install.sh | |
./dotnet-install.sh --version latest | |
apt-get update | |
apt-get install -y openjdk-17-jre-headless | |
apt-get install -y dotnet-sdk-6.0 | |
dotnet tool install dotnet-sonarscanner --tool-path . | |
./dotnet-sonarscanner begin \ | |
/o:"finol-digital" \ | |
/k:"finol-digital_Card-Game-Simulator" \ | |
/d:sonar.token="$SONAR_TOKEN" \ | |
/d:sonar.host.url=https://sonarcloud.io \ | |
/d:sonar.exclusions=**/Plugins/** | |
dotnet build Card-Game-Simulator.sln | |
./dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" | |
cd Card-Game-Simulator | |
- name: SonarQube Quality Gate Check | |
uses: SonarSource/[email protected] | |
with: | |
scanMetadataReportFile: ../.sonarqube/out/.sonar/report-task.txt | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
buildWithLinux: | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: ubuntu-latest | |
needs: [tests, lint] | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: | |
- Android | |
- iOS | |
- StandaloneLinux64 | |
- WebGL | |
outputs: | |
buildVersion: ${{ steps.buildStep.outputs.buildVersion }} | |
steps: | |
- name: Pre-pull Unity Docker image | |
run: | | |
docker pull unityci/editor:${{ env.UNITY_VERSION }}-linux-${{ matrix.targetPlatform }}-3 & | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
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: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-buildLinux-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: Library-buildLinux-${{ matrix.targetPlatform }}- | |
- name: Free Disk Space | |
uses: jlumbroso/[email protected] | |
with: | |
large-packages: false | |
- name: Build Unity Project | |
id: buildStep | |
uses: game-ci/unity-builder@main | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
with: | |
targetPlatform: ${{ matrix.targetPlatform }} | |
buildMethod: Cgs.Editor.BuildCgs.BuildOptions | |
androidExportType: androidAppBundle | |
androidKeystoreName: finoldigital.keystore | |
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }} | |
androidKeyaliasName: cgs | |
androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }} | |
androidTargetSdkVersion: AndroidApiLevel34 | |
- name: Upload Build | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'pull_request' || github.event.action == 'published' || contains(github.event.inputs.workflow_mode, matrix.targetPlatform) || (contains(github.event.inputs.workflow_mode, 'Steam') && matrix.targetPlatform == 'StandaloneLinux64') | |
with: | |
path: build/${{ matrix.targetPlatform }} | |
name: cgs-${{ matrix.targetPlatform }} | |
- name: Zip Build | |
uses: vimtor/[email protected] | |
if: github.event.action == 'published' && matrix.targetPlatform == 'StandaloneLinux64' | |
with: | |
files: build/${{ matrix.targetPlatform }}/ | |
dest: cgs-${{ matrix.targetPlatform }}.zip | |
- name: Upload Zip to GitHub Release | |
uses: svenstaro/upload-release-action@v2 | |
if: github.event.action == 'published' && matrix.targetPlatform == 'StandaloneLinux64' | |
with: | |
repo_token: ${{ secrets.CGS_PAT }} | |
asset_name: cgs-${{ matrix.targetPlatform }}.zip | |
file: cgs-${{ matrix.targetPlatform }}.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
body: ${{ github.event.release.body }} | |
buildWithMac: | |
name: Build for StandaloneOSX | |
runs-on: macos-14 | |
needs: [tests, lint] | |
if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, 'release') || contains(github.event.inputs.workflow_mode, 'Steam') || contains(github.event.inputs.workflow_mode, 'Standalone') | |
outputs: | |
buildVersion: ${{ steps.buildStep.outputs.buildVersion }} | |
timeout-minutes: 180 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
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: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-buildMac-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: Library-buildMac- | |
- name: Build Unity Project | |
id: buildStep | |
uses: game-ci/unity-builder@main | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
with: | |
targetPlatform: StandaloneOSX | |
buildMethod: Cgs.Editor.BuildCgs.BuildOptions | |
cacheUnityInstallationOnMac: true | |
- name: Fix File Permissions and Code-Sign | |
env: | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
APPLE_TEAM_NAME: ${{ secrets.APPLE_TEAM_NAME }} | |
APPLE_APPLICATION_CERTIFICATE: ${{ secrets.APPLE_APPLICATION_CERTIFICATE }} | |
APPLE_APPLICATION_PASSWORD: ${{ secrets.APPLE_APPLICATION_PASSWORD }} | |
APPLE_DISTRIBUTION_CERTIFICATE: ${{ secrets.APPLE_DISTRIBUTION_CERTIFICATE }} | |
APPLE_DISTRIBUTION_PASSWORD: ${{ secrets.APPLE_DISTRIBUTION_PASSWORD }} | |
APPLE_INSTALLER_CERTIFICATE: ${{ secrets.APPLE_INSTALLER_CERTIFICATE }} | |
APPLE_INSTALLER_PASSWORD: ${{ secrets.APPLE_INSTALLER_PASSWORD }} | |
MAC_APP_BUNDLE_PATHS: Contents/PlugIns/StandaloneFileBrowser.bundle | |
MAC_BUILD_PATH: ${{ format('{0}/build/StandaloneOSX', github.workspace) }} | |
PROJECT_NAME: Card Game Simulator | |
run: | | |
bundle install | |
bundle exec fastlane mac fixversion | |
find $MAC_BUILD_PATH -type f -name "**.sh" -exec chmod +x {} \; | |
chmod +x fastlane/sign-mac-build.sh | |
./fastlane/sign-mac-build.sh | |
- name: Upload Build | |
if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, 'StandaloneOSX') || contains(github.event.inputs.workflow_mode, 'Steam') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cgs-StandaloneOSX | |
path: build/StandaloneOSX | |
- name: Upload App | |
uses: actions/upload-artifact@v4 | |
if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, 'StandaloneOSX') || contains(github.event.inputs.workflow_mode, 'Steam') | |
with: | |
path: build/StandaloneOSX/Card Game Simulator.app | |
name: Card Game Simulator.app | |
- name: Zip App | |
uses: vimtor/[email protected] | |
if: github.event.action == 'published' | |
with: | |
files: build/StandaloneOSX/ | |
dest: build/cgs-StandaloneOSX.zip | |
- name: Upload Zip to GitHub Release | |
uses: svenstaro/upload-release-action@v2 | |
if: github.event.action == 'published' | |
with: | |
repo_token: ${{ secrets.CGS_PAT }} | |
asset_name: cgs-StandaloneOSX.zip | |
file: build/cgs-StandaloneOSX.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
body: ${{ github.event.release.body }} | |
deployToAppStore: | |
name: Deploy to the App Store | |
runs-on: macos-14 | |
needs: buildWithLinux | |
if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'iOS')) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download iOS Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-iOS | |
path: build/iOS | |
- name: Update Release Notes | |
if: github.event.action == 'published' | |
env: | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: echo "$RELEASE_NOTES" > fastlane/metadata/en-US/release_notes.txt | |
- name: Fix File Permissions and Run Fastlane | |
env: | |
APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }} | |
APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
APPLE_TEAM_NAME: ${{ secrets.APPLE_TEAM_NAME }} | |
MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }} | |
MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
MATCH_PERSONAL_ACCESS_TOKEN: ${{ secrets.CGS_PAT }} | |
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }} | |
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }} | |
APPSTORE_P8: ${{ secrets.APPSTORE_P8 }} | |
USYM_UPLOAD_AUTH_TOKEN: ${{ secrets.USYM_UPLOAD_AUTH_TOKEN }} | |
IOS_BUILD_PATH: ${{ format('{0}/build/iOS', github.workspace) }} | |
IOS_BUNDLE_ID: com.finoldigital.CardGameSim | |
PROJECT_NAME: Card Game Simulator | |
run: | | |
eval "$(ssh-agent -s)" | |
ssh-add - <<< "${MATCH_DEPLOY_KEY}" | |
find $IOS_BUILD_PATH -type f -name "**.sh" -exec chmod +x {} \; | |
find $IOS_BUILD_PATH -type f -iname "usymtool" -exec chmod +x {} \; | |
bundle install | |
bundle exec fastlane ios release | |
deployToGooglePlayTest: | |
name: Deploy to the Google Play Store Test | |
runs-on: ubuntu-latest | |
needs: buildWithLinux | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download Android Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-Android | |
path: build/Android | |
- name: Update Release Notes | |
env: | |
RELEASE_NOTES: ${{ github.event.pull_request.body }} | |
run: echo "$RELEASE_NOTES" > fastlane/metadata/android/en-US/changelogs/default.txt | |
- name: Add Authentication | |
env: | |
GOOGLE_PLAY_KEY_FILE: ${{ secrets.GOOGLE_PLAY_KEY_FILE }} | |
GOOGLE_PLAY_KEY_FILE_PATH: ${{ format('{0}/fastlane/api-finoldigital.json', github.workspace) }} | |
run: echo "$GOOGLE_PLAY_KEY_FILE" > $GOOGLE_PLAY_KEY_FILE_PATH | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
bundler-cache: true | |
- name: Upload to Google Play | |
env: | |
GOOGLE_PLAY_KEY_FILE_PATH: ${{ format('{0}/fastlane/api-finoldigital.json', github.workspace) }} | |
ANDROID_BUILD_FILE_PATH: ${{ format('{0}/build/Android/Android.aab', github.workspace) }} | |
ANDROID_PACKAGE_NAME: com.finoldigital.cardgamesim | |
uses: maierj/[email protected] | |
with: | |
lane: 'android playtest' | |
deployToGooglePlayProduction: | |
name: Deploy to the Google Play Store Production | |
runs-on: ubuntu-latest | |
needs: buildWithLinux | |
if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'Android')) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download Android Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-Android | |
path: build/Android | |
- name: Update Release Notes | |
if: github.event.action == 'published' | |
env: | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: echo "$RELEASE_NOTES" > fastlane/metadata/android/en-US/changelogs/default.txt | |
- name: Add Authentication | |
env: | |
GOOGLE_PLAY_KEY_FILE: ${{ secrets.GOOGLE_PLAY_KEY_FILE }} | |
GOOGLE_PLAY_KEY_FILE_PATH: ${{ format('{0}/fastlane/api-finoldigital.json', github.workspace) }} | |
run: echo "$GOOGLE_PLAY_KEY_FILE" > $GOOGLE_PLAY_KEY_FILE_PATH | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
bundler-cache: true | |
- name: Upload to Google Play | |
env: | |
GOOGLE_PLAY_KEY_FILE_PATH: ${{ format('{0}/fastlane/api-finoldigital.json', github.workspace) }} | |
ANDROID_BUILD_FILE_PATH: ${{ format('{0}/build/Android/Android.aab', github.workspace) }} | |
ANDROID_PACKAGE_NAME: com.finoldigital.cardgamesim | |
uses: maierj/[email protected] | |
with: | |
lane: 'android playprod' | |
deployToFirebase: | |
name: Deploy to the Web via Firebase | |
runs-on: ubuntu-latest | |
needs: buildWithLinux | |
if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'WebGL')) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download WebGL Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-WebGL | |
path: build/WebGL | |
- name: Copy the WebGL build files to the Firebase public directory | |
run: cp -r build/WebGL/WebGL/Build/. firebase/public/Build | |
- name: Firebase Deploy | |
uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: ${{ secrets.GITHUB_TOKEN }} | |
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CARD_GAME_SIMULATOR }} | |
channelId: live | |
projectId: card-game-simulator | |
entryPoint: firebase | |
deployToMacAppStore: | |
name: Deploy to the Mac App Store | |
runs-on: macos-14 | |
needs: buildWithMac | |
if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'StandaloneOSX')) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download StandaloneOSX Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-StandaloneOSX | |
path: build/StandaloneOSX | |
- name: Update Release Notes | |
if: github.event.action == 'published' | |
env: | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: echo "$RELEASE_NOTES" > fastlane/metadata/en-US/release_notes.txt | |
- name: Run Fastlane | |
env: | |
APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }} | |
APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }} | |
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }} | |
APPSTORE_P8: ${{ secrets. APPSTORE_P8 }} | |
MAC_BUILD_PATH: ${{ format('{0}/build/StandaloneOSX', github.workspace) }} | |
MAC_BUNDLE_ID: com.finoldigital.CardGameSimulator | |
PROJECT_NAME: Card Game Simulator | |
run: | | |
bundle install | |
bundle exec fastlane mac macupload | |
buildWithWindows: | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: windows-2022 | |
needs: [buildWithLinux, buildWithMac] | |
outputs: | |
buildVersion: ${{ steps.buildStep.outputs.buildVersion }} | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: | |
- StandaloneWindows | |
- StandaloneWindows64 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
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: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-buildWindows-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library-buildWindows-${{ matrix.targetPlatform }}- | |
Library-buildWindows- | |
- name: Build Unity Project | |
id: buildStep | |
timeout-minutes: 45 | |
uses: game-ci/unity-builder@main | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
with: | |
targetPlatform: ${{ matrix.targetPlatform }} | |
buildMethod: Cgs.Editor.BuildCgs.BuildOptions | |
- name: Upload Build | |
uses: actions/upload-artifact@v4 | |
if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, matrix.targetPlatform) || (contains(github.event.inputs.workflow_mode, 'Steam') && contains(matrix.targetPlatform, 'StandaloneWindows')) | |
with: | |
path: build/${{ matrix.targetPlatform }} | |
name: cgs-${{ matrix.targetPlatform }} | |
- name: Zip Build | |
uses: vimtor/[email protected] | |
if: github.event.action == 'published' && matrix.targetPlatform != 'WSAPlayer' | |
with: | |
files: build/${{ matrix.targetPlatform }}/ | |
dest: cgs-${{ matrix.targetPlatform }}.zip | |
- name: Upload Zip to GitHub Release | |
uses: svenstaro/upload-release-action@v2 | |
if: github.event.action == 'published' && matrix.targetPlatform != 'WSAPlayer' | |
with: | |
repo_token: ${{ secrets.CGS_PAT }} | |
asset_name: cgs-${{ matrix.targetPlatform }}.zip | |
file: cgs-${{ matrix.targetPlatform }}.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
body: ${{ github.event.release.body }} | |
deployToSteam: | |
name: Deploy to the Steam Marketplace | |
runs-on: ubuntu-latest | |
needs: buildWithWindows | |
if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'Steam')) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download StandaloneWindows Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-StandaloneWindows | |
path: build/StandaloneWindows | |
- name: Download StandaloneLinux64 Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-StandaloneLinux64 | |
path: build/StandaloneLinux64 | |
- name: Download StandaloneWindows64 Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-StandaloneWindows64 | |
path: build/StandaloneWindows64 | |
- name: Download App | |
uses: actions/download-artifact@v4 | |
with: | |
name: Card Game Simulator.app | |
path: build/StandaloneOSX/Card Game Simulator.app | |
- name: Deploy to Steam | |
uses: game-ci/steam-deploy@main | |
with: | |
username: ${{ secrets.STEAM_USERNAME }} | |
configVdf: ${{ secrets.STEAM_CONFIG_VDF }} | |
appId: 1742850 | |
buildDescription: v${{ needs.buildWithWindows.outputs.buildVersion }} | |
rootPath: build | |
depot1Path: StandaloneWindows | |
depot2Path: StandaloneLinux64 | |
depot3Path: StandaloneWindows64 | |
depot4Path: StandaloneOSX | |
releaseBranch: prerelease | |
buildWSAPlayer: | |
name: Build for WSAPlayer | |
runs-on: windows-2022 | |
needs: buildWithWindows | |
outputs: | |
buildVersion: ${{ steps.build.outputs.buildVersion }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
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: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-WSAPlayer-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: Library-WSAPlayer | |
- name: Build Unity Project | |
id: build | |
timeout-minutes: 45 | |
uses: game-ci/unity-builder@main | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }} | |
with: | |
targetPlatform: WSAPlayer | |
buildMethod: Cgs.Editor.BuildCgs.BuildOptions | |
- name: Upload Build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cgs-WSAPlayer | |
path: build/WSAPlayer | |
deployToMicrosoftStore: | |
name: Deploy to the Microsoft Store | |
runs-on: windows-2022 | |
needs: buildWSAPlayer | |
if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'WSAPlayer')) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download WSAPlayer Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cgs-WSAPlayer | |
path: build/WSAPlayer | |
- name: Move Card-Game-Simulator.git | |
run: | | |
mkdir C:/Card-Game-Simulator.git | |
mkdir C:/Card-Game-Simulator.git/build | |
mv * C:/Card-Game-Simulator.git | |
# mv build/WSAPlayer C:/Card-Game-Simulator.git/build | |
- name: Setup Unity UWP | |
uses: kuler90/setup-unity@v1 | |
with: | |
unity-modules: universal-windows-platform | |
project-path: C:/Card-Game-Simulator.git | |
- name: Setup Developer Command Prompt for Microsoft Visual C++ | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Update Release Notes | |
working-directory: C:/Card-Game-Simulator.git | |
if: github.event.action == 'published' | |
shell: bash | |
env: | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: echo "$RELEASE_NOTES" > fastlane/metadata/en-US/release_notes.txt | |
- name: Get Release Notes | |
working-directory: C:/Card-Game-Simulator.git | |
id: changelog | |
shell: bash | |
run: | | |
export RELEASE_NOTES="$(cat fastlane/metadata/en-US/release_notes.txt)" | |
echo "$RELEASE_NOTES" | |
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_OUTPUT | |
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Apply Release Notes | |
uses: davidmfinol/replace-action@master | |
with: | |
files: "C:/Card-Game-Simulator.git/storebroker/en-us/PDP.xml" | |
replacements: "OUTPUT_RELEASE_NOTES=${{ steps.changelog.outputs.RELEASE_NOTES }}" | |
- name: Prepare project | |
# Fix UnityWSAPlayerDir | |
# Remove to_remove.txt | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
UnityWsaPlayerDir: ${{ format('C:\Program Files\Unity\Hub\Editor\{0}\Editor\Data\PlaybackEngines\MetroSupport\', env.UNITY_VERSION) }} | |
WsaPlayerDirectory: build\WSAPlayer\WSAPlayer | |
UwpProjectDirectory: build\WSAPlayer\WSAPlayer\Card Game Simulator | |
run: | | |
[xml]$manifest = get-content ".\$env:WsaPlayerDirectory\UnityCommon.props" | |
$manifest.Project.PropertyGroup.UnityWSAPlayerDir = "$env:UnityWsaPlayerDir" | |
$manifest.save(".\$env:WsaPlayerDirectory\UnityCommon.props") | |
echo ".\$env:WsaPlayerDirectory\UnityCommon.props" | |
cat ".\$env:WsaPlayerDirectory\UnityCommon.props" | |
$content_to_remove = Get-Content -Path C:\Card-Game-Simulator.git\storebroker\to_remove.txt -Raw | |
echo "$content_to_remove" | |
$targetContent = Get-Content -Path ".\$env:UwpProjectDirectory\Unity Data.vcxitems" -Raw | |
$updatedContent = $targetContent -replace [regex]::Escape($content_to_remove), '' | |
$updatedContent | Set-Content -Path ".\$env:UwpProjectDirectory\Unity Data.vcxitems" | |
cat ".\$env:UwpProjectDirectory\Unity Data.vcxitems" | |
- name: Upload Build2 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cgs-WSAPlayer2 | |
path: ${{ format('{0}\build\WSAPlayer', 'C:\Card-Game-Simulator.git') }} | |
- name: Remove spaces from project name | |
# Remove Spaces | |
if: false | |
uses: davidmfinol/replace-action@master | |
with: | |
files: "C:/Card-Game-Simulator.git/build/WSAPlayer/WSAPlayer/Card Game Simulator.sln" | |
replacements: "\"Card Game Simulator\"=\"CardGameSimulator\"" | |
- name: Remove spaces from project name 2 | |
# Remove Spaces | |
if: false | |
uses: davidmfinol/replace-action@master | |
with: | |
files: "C:/Card-Game-Simulator.git/build/WSAPlayer/WSAPlayer/Card Game Simulator/Card Game Simulator.vcxproj" | |
replacements: "</PropertyGroup>=<ProjectName>CardGameSimulator</ProjectName></PropertyGroup>" | |
- name: Add Package.StoreAssociation.xml to .vcxproj | |
# Associate with App Store | |
if: false | |
uses: mingjun97/file-regex-replace@v1 | |
with: | |
regex: '<ProjectName>CardGameSimulator</ProjectName></PropertyGroup>' | |
replacement: '<ProjectName>CardGameSimulator</ProjectName></PropertyGroup><ItemGroup><None Include="Package.StoreAssociation.xml" /></ItemGroup>' | |
path: 'C:/Card-Game-Simulator.git/build/WSAPlayer/WSAPlayer/Card Game Simulator' | |
- name: Add Package.StoreAssociation.xml to .vcxproj.filters | |
# Associate with App Store | |
if: false | |
uses: mingjun97/file-regex-replace@v1 | |
with: | |
regex: '</ItemGroup>' | |
replacement: '</ItemGroup><ItemGroup><None Include="Package.StoreAssociation.xml" /></ItemGroup>' | |
path: 'C:/Card-Game-Simulator.git/build/WSAPlayer/WSAPlayer/Card Game Simulator' | |
include: 'Card Game Simulator\.vcxproj\.filters' | |
- name: Update the Package.appxmanifest | |
# Associate with App Store | |
if: false | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
UwpProjectDirectory: build\WSAPlayer\WSAPlayer\Card Game Simulator | |
run: | | |
Copy-Item "C:\Card-Game-Simulator.git\storebroker\Package.StoreAssociation.xml" -Destination ".\$env:UwpProjectDirectory\" | |
Copy-Item "C:\Card-Game-Simulator.git\storebroker\CardGameSimulator.vcxproj.user" -Destination ".\$env:UwpProjectDirectory\" | |
[xml]$manifest = get-content ".\$env:UwpProjectDirectory\Package.appxmanifest" | |
$manifest.Package.Identity.Name = "FinolDigitalLLC.CardGameSimulator" | |
$manifest.Package.Identity.Publisher = "CN=BBF9912B-079E-4CCE-A441-0D6EA6798115" | |
$manifest.save(".\$env:UwpProjectDirectory\Package.appxmanifest") | |
echo ".\$env:UwpProjectDirectory\Package.appxmanifest" | |
cat ".\$env:UwpProjectDirectory\Package.appxmanifest" | |
- name: Decode the Pfx | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
UwpProjectDirectory: build\WSAPlayer\WSAPlayer\Card Game Simulator | |
SigningCertificate: Card Game Simulator_StoreKey.pfx | |
run: | | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.MICROSOFT_STORE_PFX_FILE }}") | |
$currentDirectory = Get-Location | |
$certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:UwpProjectDirectory -AdditionalChildPath $env:SigningCertificate | |
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
- name: Setup Microsoft Store Developer CLI | |
uses: microsoft/setup-msstore-cli@v1 | |
- name: Configure Microsoft Store Developer CLI | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
run: msstore reconfigure --tenantId ${{ secrets.MICROSOFT_TENANT_ID }} --sellerId ${{ secrets.MICROSOFT_SELLER_ID }} --clientId ${{ secrets.MICROSOFT_CLIENT_ID }} --clientSecret ${{ secrets.MICROSOFT_KEY }} | |
- name: Build the .appxupload with Microsoft Store Developer CLI | |
if: false | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
run: | | |
dir "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer" | |
dir "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer\Card Game Simulator" | |
msstore init "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer\Card Game Simulator\Package.appxmanifest" | |
dir "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer" | |
dir "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer\Card Game Simulator" | |
msstore package "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer\Card Game Simulator\Package.appxmanifest" | |
dir "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer" | |
dir "C:\Card-Game-Simulator.git\build\WSAPlayer\WSAPlayer\Card Game Simulator" | |
- name: Build the .appxupload | |
if: false | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
SolutionPath: build\WSAPlayer\WSAPlayer\Card Game Simulator.sln | |
SigningCertificate: Card Game Simulator_StoreKey.pfx | |
run: msbuild $env:SolutionPath /p:Configuration="Master" /p:Platform="x64" /p:UapAppxPackageBuildMode="StoreUpload" /p:AppxBundle="Always" /p:AppxBundlePlatforms="x86|x64|arm|arm64" /p:PackageCertificateKeyFile=$env:SigningCertificate | |
- name: Remove the .pfx | |
if: false | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
UwpProjectDirectory: build\WSAPlayer\WSAPlayer\Card Game Simulator | |
SigningCertificate: Card Game Simulator_StoreKey.pfx | |
run: Remove-Item -path $env:UwpProjectDirectory\$env:SigningCertificate | |
- name: Copy .appxupload | |
if: false | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
APPX_PATH: ${{ format('build\WSAPlayer\WSAPlayer\AppPackages\Card Game Simulator\Card Game Simulator_{0}.0_x86_x64_arm_arm64_bundle_Master.appxupload', needs.buildWSAPlayer.outputs.buildVersion) }} | |
upload_path: ${{ format('Card Game Simulator_{0}.0_x86_x64_arm_arm64_bundle_Master.appxupload', needs.buildWSAPlayer.outputs.buildVersion) }} | |
run: Copy-Item ".\$env:APPX_PATH" -Destination ".\$env:upload_path" | |
- name: Upload .appxupload | |
if: false | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ format('Card Game Simulator_{0}.0_x86_x64_arm_arm64_bundle_Master.appxupload', needs.buildWSAPlayer.outputs.buildVersion) }} | |
path: ${{ format('{0}\Card Game Simulator_{1}.0_x86_x64_arm_arm64_bundle_Master.appxupload', 'C:\Card-Game-Simulator.git', needs.buildWSAPlayer.outputs.buildVersion) }} | |
- name: Publish to the Microsoft Store | |
if: false | |
uses: isaacrlevin/[email protected] | |
with: | |
tenant-id: ${{ secrets.MICROSOFT_TENANT_ID }} | |
client-id: ${{ secrets.MICROSOFT_CLIENT_ID }} | |
client-secret: ${{ secrets.MICROSOFT_KEY }} | |
app-id: 9N96N5S4W3J0 | |
package-path: ${{ format('{0}\build\WSAPlayer\WSAPlayer\AppPackages\Card Game Simulator\Card Game Simulator_{1}.0_x86_x64_arm_arm64_bundle_Master.appxupload', 'C:\Card-Game-Simulator.git', needs.buildWSAPlayer.outputs.buildVersion) }} | |
- name: Upload to the Microsoft Store | |
if: false | |
working-directory: C:/Card-Game-Simulator.git | |
shell: pwsh | |
env: | |
MICROSOFT_TENANT_ID: ${{ secrets.MICROSOFT_TENANT_ID }} | |
MICROSOFT_CLIENT_ID: ${{ secrets.MICROSOFT_CLIENT_ID }} | |
MICROSOFT_KEY: ${{ secrets.MICROSOFT_KEY }} | |
MICROSOFT_APP_ID: 9N96N5S4W3J0 | |
STOREBROKER_CONFIG_PATH: ${{ format('{0}\storebroker\SBConfig.json', 'C:\Card-Game-Simulator.git') }} | |
PDP_ROOT_PATH: ${{ format('{0}\storebroker\', 'C:\Card-Game-Simulator.git') }} | |
IMAGES_ROOT_PATH: ${{ format('{0}\docs\assets\img\', 'C:\Card-Game-Simulator.git') }} | |
APPX_PATH: ${{ format('{0}\build\WSAPlayer\WSAPlayer\AppPackages\Card Game Simulator\Card Game Simulator_{1}.0_x86_x64_arm_arm64_bundle_Master.appxupload', 'C:\Card-Game-Simulator.git', needs.buildWSAPlayer.outputs.buildVersion) }} | |
OUT_PATH: ${{ format('{0}\build\WSAPlayer\WSAPlayer\', 'C:\Card-Game-Simulator.git') }} | |
SUBMISSION_DATA_PATH: ${{ format('{0}\build\WSAPlayer\WSAPlayer\upload.json', 'C:\Card-Game-Simulator.git') }} | |
PACKAGE_PATH: ${{ format('{0}\build\WSAPlayer\WSAPlayer\upload.zip', 'C:\Card-Game-Simulator.git') }} | |
run: | | |
Install-Module -Name StoreBroker -AcceptLicense -Force | |
$pass = ConvertTo-SecureString $env:MICROSOFT_KEY -AsPlainText -Force | |
$cred = New-Object System.Management.Automation.PSCredential ($env:MICROSOFT_CLIENT_ID, $pass) | |
Set-StoreBrokerAuthentication -TenantId $env:MICROSOFT_TENANT_ID -Credential $cred | |
New-SubmissionPackage -ConfigPath $env:STOREBROKER_CONFIG_PATH -PDPRootPath $env:PDP_ROOT_PATH -ImagesRootPath $env:IMAGES_ROOT_PATH -AppxPath "$env:APPX_PATH" -OutPath $env:OUT_PATH -OutName 'upload' -Verbose | |
Update-ApplicationSubmission -AppId $env:MICROSOFT_APP_ID -SubmissionDataPath $env:SUBMISSION_DATA_PATH -PackagePath $env:PACKAGE_PATH -ReplacePackages -UpdateListings -AutoCommit -Force | |
announceReleaseToSocialMedia: | |
name: Announce Release to Social Media | |
runs-on: ubuntu-latest | |
needs: [buildWithWindows, deployToAppStore, deployToGooglePlayProduction, deployToFirebase, deployToMacAppStore, deployToSteam, deployToMicrosoftStore] | |
if: github.event.action == 'published' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Update Release Notes | |
if: github.event.action == 'published' | |
env: | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: echo "$RELEASE_NOTES" > fastlane/metadata/en-US/release_notes.txt | |
- name: Prepare Announcement | |
id: prepare | |
shell: bash | |
env: | |
VERSION: v${{ needs.buildWithWindows.outputs.buildVersion }} | |
RELEASE_NOTES: ${{ github.event.release.body }} | |
run: | | |
RELEASE_NOTES="$(cat fastlane/metadata/en-US/release_notes.txt)" | |
ANNOUNCEMENT="Released CGS $VERSION! | |
$RELEASE_NOTES" | |
printf "$ANNOUNCEMENT" | |
export ANNOUNCEMENT | |
echo 'ANNOUNCEMENT<<EOF' >> $GITHUB_OUTPUT | |
echo "$ANNOUNCEMENT" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Discord Announcement | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: ${{ steps.prepare.outputs.ANNOUNCEMENT }} |