Skip to content

Implement copyright #1390

Implement copyright

Implement copyright #1390

Workflow file for this run

name: Test, Build, and Deploy with GameCI
concurrency: unity
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
steps:
- name: Checkout Repository
uses: actions/checkout@v3
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@v3
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@v3
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 }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
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-2022.3.8f1-linux-il2cpp-2
steps:
- name: Checkout Repository
uses: actions/checkout@v1
with:
lfs: true
- name: Cache Library
uses: actions/cache@v3
with:
path: Library
key: Library-lint-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: Library-lint-
- name: Activate Unity
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
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()
run: unity-editor -logFile /dev/stdout -quit -returnlicense
- 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.login="$SONAR_TOKEN" \
/d:sonar.host.url=https://sonarcloud.io \
/d:sonar.exclusions=Assets/Plugins/**
dotnet build Card-Game-Simulator.sln
./dotnet-sonarscanner end /d:sonar.login="$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.build.outputs.buildVersion }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
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@v3
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@v3
with:
path: Library
key: Library-buildLinux-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: Library-buildLinux-${{ matrix.targetPlatform }}-
- name: Free Disk Space
if: matrix.targetPlatform == 'Android' || matrix.targetPlatform == 'StandaloneLinux64'
uses: jlumbroso/[email protected]
with:
large-packages: false
- name: Build Unity Project
id: build
uses: game-ci/unity-builder@main
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
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: AndroidApiLevel33
- name: Upload Build
uses: actions/upload-artifact@v3
if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, matrix.targetPlatform) || (contains(github.event.inputs.workflow_mode, 'Steam') && matrix.targetPlatform == 'StandaloneLinux64')
with:
name: cgs-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
- name: Zip Build
uses: vimtor/[email protected]
if: github.event.action == 'published' && matrix.targetPlatform == 'StandaloneLinux64'
with:
files: build/${{ matrix.targetPlatform }}/
dest: build/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: build/cgs-${{ matrix.targetPlatform }}.zip
tag: ${{ github.ref }}
overwrite: true
body: ${{ github.event.release.body }}
buildWithMac:
name: Build for StandaloneOSX
runs-on: macos-latest
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.build.outputs.buildVersion }}
timeout-minutes: 90
steps:
- name: Checkout Repository
uses: actions/checkout@v3
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@v3
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@v3
with:
path: Library
key: Library-buildMac-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: Library-buildMac-
- name: Build Unity Project
id: build
uses: game-ci/unity-builder@main
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
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_DISTRIBUTION_CERTIFICATE: ${{ secrets.APPLE_DISTRIBUTION_CERTIFICATE }}
APPLE_DISTRIBUTION_PASSWORD: ${{ secrets.APPLE_DISTRIBUTION_PASSWORD }}
MAC_INSTALLER_CERTIFICATE: ${{ secrets.MAC_INSTALLER_CERTIFICATE }}
MAC_INSTALLER_PASSWORD: ${{ secrets.MAC_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@v3
with:
name: cgs-StandaloneOSX
path: build/StandaloneOSX
- name: Upload App
uses: actions/upload-artifact@v3
if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, 'StandaloneOSX') || contains(github.event.inputs.workflow_mode, 'Steam')
with:
name: Card Game Simulator.app
path: build/StandaloneOSX/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-latest
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@v3
- name: Download iOS Artifact
uses: actions/download-artifact@v3
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
deployToGooglePlay:
name: Deploy to the Google Play Store
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@v3
- name: Download Android Artifact
uses: actions/download-artifact@v3
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@v3
with:
path: Card-Game-Simulator
- name: Download WebGL Artifact
uses: actions/download-artifact@v3
with:
name: cgs-WebGL
path: Card-Game-Simulator/build/WebGL
- name: Checkout Firebase project
uses: actions/checkout@v3
with:
repository: finol-digital/cgs-games
token: ${{ secrets.CGS_PAT }}
path: cgs-games
- name: Copy the WebGL build artifacts to the Firebase public directory
env:
UNITY_BUILD_WEBGL_PATH: ${{ format('{0}/Card-Game-Simulator/build/WebGL', github.workspace) }}
FIREBASE_PUBLIC_BUILD_PATH: ${{ format('{0}/cgs-games/public/Unity', github.workspace) }}
run: find $UNITY_BUILD_WEBGL_PATH -type f -name "**WebGL.*" -exec cp {} $FIREBASE_PUBLIC_BUILD_PATH \;
- name: Update Release Notes
if: github.event.action == 'published'
env:
RELEASE_NOTES: ${{ github.event.release.body }}
run: echo "$RELEASE_NOTES" > Card-Game-Simulator/fastlane/metadata/en-US/release_notes.txt
- name: Raise PR to CGS games
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.CGS_PAT }}
path: cgs-games
branch: ${{ needs.buildWithLinux.outputs.buildVersion }}
title: ${{ needs.buildWithLinux.outputs.buildVersion }}
body-path: Card-Game-Simulator/fastlane/metadata/en-US/release_notes.txt
deployToMacAppStore:
name: Deploy to the Mac App Store
runs-on: macos-latest
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@v3
- name: Download StandaloneOSX Artifact
uses: actions/download-artifact@v3
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-2019
needs: [buildWithLinux, buildWithMac]
outputs:
buildVersion: ${{ steps.build-1.outputs.buildVersion }}
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneWindows
- StandaloneWindows64
steps:
- name: Checkout Repository
uses: actions/checkout@v3
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@v3
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@v3
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: build-0
continue-on-error: true
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: Sleep for Retry
if: ${{ steps.build-0.outcome == 'failure' }}
run: Start-Sleep -s 120
- name: Build Retry
id: build-1
continue-on-error: true
timeout-minutes: 45
if: steps.build-0.outcome == 'failure'
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: Sleep for Retry 2
if: ${{ steps.build-0.outcome == 'failure' && steps.build-1.outcome == 'failure' }}
run: Start-Sleep -s 240
- name: Build Retry 2
id: build-2
timeout-minutes: 45
if: ${{ steps.build-0.outcome == 'failure' && steps.build-1.outcome == 'failure' }}
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@v3
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:
name: cgs-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
- name: Zip Build
uses: vimtor/[email protected]
if: github.event.action == 'published' && matrix.targetPlatform != 'WSAPlayer'
with:
files: build/${{ matrix.targetPlatform }}/
dest: build/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: build/cgs-${{ matrix.targetPlatform }}.zip
tag: ${{ github.ref }}
overwrite: true
body: ${{ github.event.release.body }}
deployToMicrosoftStore:
name: Deploy to the Microsoft Store
runs-on: windows-2019
needs: buildWithWindows
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@v3
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@v3
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: Build Unity Project
id: build-0
continue-on-error: true
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: Sleep for Retry
if: ${{ steps.build-0.outcome == 'failure' }}
run: Start-Sleep -s 120
- name: Build Retry
id: build-1
continue-on-error: true
timeout-minutes: 45
if: steps.build-0.outcome == 'failure'
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: Sleep for Retry 2
if: ${{ steps.build-0.outcome == 'failure' && steps.build-1.outcome == 'failure' }}
run: Start-Sleep -s 240
- name: Build Retry 2
id: build-2
timeout-minutes: 45
if: ${{ steps.build-0.outcome == 'failure' && steps.build-1.outcome == 'failure' }}
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@v3
with:
name: cgs-WSAPlayer
path: build/WSAPlayer
- name: Checkout Card-Game-Simulator
run: |
mkdir C:/Card-Game-Simulator.git
git clone https://github.com/finol-digital/Card-Game-Simulator.git C:/Card-Game-Simulator.git --depth=1
mkdir C:/Card-Game-Simulator.git/build
mv build/WSAPlayer C:/Card-Game-Simulator.git/build
ls C:/Card-Game-Simulator.git/build
ls C:/Card-Game-Simulator.git/build/WSAPlayer
ls C:/Card-Game-Simulator.git/build/WSAPlayer/WSAPlayer
- 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: 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@v1
- name: Remove spaces from project name
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
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
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
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: Copy the Package.StoreAssociation.xml and CardGameSimulator.vcxproj.user
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\"
- name: Update the Package.appxmanifest
if: false
working-directory: C:/Card-Game-Simulator.git
shell: pwsh
env:
UwpProjectDirectory: build\WSAPlayer\WSAPlayer\Card Game Simulator
run: |
[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: Upload Build2
uses: actions/upload-artifact@v3
with:
name: cgs-WSAPlayer2
path: ${{ format('{0}\build\WSAPlayer', 'C:\Card-Game-Simulator.git') }}
- 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: Build the .appxupload
# Remove None Include for il2cppFileRoot.txt and LineNumberMappings.json
if: false
# See: https://forum.unity.com/threads/uwp-errors-in-visual-studio.1461980/
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
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: Upload .appxupload
# Remove None Include for il2cppFileRoot.txt and LineNumberMappings.json
if: false
# See: https://forum.unity.com/threads/uwp-errors-in-visual-studio.1461980/
uses: actions/upload-artifact@v3
with:
name: ${{ format('CardGameSimulator_{0}.0_x86_x64_arm_arm64_bundle_Master.appxupload', steps.build.outputs.buildVersion) }}
path: ${{ format('{0}\build\WSAPlayer\WSAPlayer\AppPackages\CardGameSimulator\CardGameSimulator_{1}.0_x86_x64_arm_arm64_bundle_Master.appxupload', 'C:\Card-Game-Simulator.git', steps.build.outputs.buildVersion) }}
- name: Upload to the Microsoft Store
# Remove None Include for il2cppFileRoot.txt and LineNumberMappings.json
if: false
# See: https://forum.unity.com/threads/uwp-errors-in-visual-studio.1461980/
working-directory: C:/Card-Game-Simulator.git
shell: pwsh
#if: false
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\CardGameSimulator\CardGameSimulator_{1}.0_x86_x64_arm_arm64_bundle_Master.appxupload', 'C:\Card-Game-Simulator.git', steps.build.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
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@v3
- name: Download StandaloneWindows Artifact
uses: actions/download-artifact@v3
with:
name: cgs-StandaloneWindows
path: build/StandaloneWindows
- name: Download StandaloneLinux64 Artifact
uses: actions/download-artifact@v3
with:
name: cgs-StandaloneLinux64
path: build/StandaloneLinux64
- name: Download StandaloneWindows64 Artifact
uses: actions/download-artifact@v3
with:
name: cgs-StandaloneWindows64
path: build/StandaloneWindows64
- name: Download App
uses: actions/download-artifact@v3
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
announceReleaseToSocialMedia:
name: Announce Release to Social Media
runs-on: ubuntu-latest
needs: [buildWithWindows, deployToAppStore, deployToGooglePlay, deployToFirebase, deployToMacAppStore, deployToMicrosoftStore, deployToSteam]
if: github.event.action == 'published'
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- 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)"
export ANNOUNCEMENT="Released CGS $VERSION! $RELEASE_NOTES"
echo "$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 }}