Update README.md #192
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: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
BUILD_CONFIGURATION: Release | |
permissions: | |
contents: read | |
jobs: | |
windows: | |
name: Windows | |
runs-on: windows-latest | |
timeout-minutes: 10 | |
env: | |
SOLUTION_FILE_PATH: Player.Windows.sln | |
PROJECT_FILE_PATH: UI/Windows/Player.UI.Windows.csproj | |
PUBLISH_PATH: "bin/Release/net6.0-windows/publish/" | |
ARTIFACT_PATH: "${{ github.workspace }}\\UI\\Windows\\bin\\Release\\net6.0-windows\\publish\\" | |
BUILD_PLATFORM: x64 | |
BUILD_ARTIFACT_NAME: "Player-win64-exe-${{github.ref_name}}-${{github.sha}}" | |
BUILD_ARTIFACT_NAME_SANITISED: "Player-win64-exe-${{github.ref_name}}-${{github.sha}}" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Apply Version | |
shell: pwsh | |
run: .\ApplyVersion.ps1 | |
- uses: microsoft/setup-msbuild@v1.3.1 | |
- name: Restore NuGet packages | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild -t:restore ${{env.SOLUTION_FILE_PATH}} -p:PublishReadyToRun=true | |
- name: Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Publish | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /m /t:publish /p:RuntimeIdentifier=win-x64 /p:PublishDir="${{env.PUBLISH_PATH}}" /p:IncludeNativeLibrariesForSelfExtract=true /p:SelfContained=false /p:PublishSingleFile=true /p:PublishReadyToRun=true /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.PROJECT_FILE_PATH}} | |
- name: Prepare artifact upload | |
shell: pwsh | |
run: | | |
$artifact_name="${{env.BUILD_ARTIFACT_NAME}}" -replace '[\\/]', '_' | |
"BUILD_ARTIFACT_NAME_SANITISED=$artifact_name" >> $env:GITHUB_ENV | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3.1.0 | |
with: | |
name: ${{env.BUILD_ARTIFACT_NAME_SANITISED }} | |
path: ${{ env.ARTIFACT_PATH }} | |
if-no-files-found: error | |
macos: | |
name: macOS | |
runs-on: macOS-12 | |
timeout-minutes: 10 | |
env: | |
SOLUTION_FILE_PATH: Player.macOS.sln | |
DECODER_WORKSPACE_PATH: Decoders/Decoders.macOS.xcworkspace | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
DECODER_LJ92_LIB_PATH: Decoders/LJ92/Build/Products/Release | |
DECODER_UNPACK_LIB_PATH: Decoders/Unpack/Build/Products/Release | |
DECODER_LJ92_ARCHIVE_PATH: Decoders/LJ92.xcarchive | |
DECODER_UNPACK_ARCHIVE_PATH: Decoders/Unpack.xcarchive | |
BUILD_STANDALONE_ARTIFACT_NAME: "Player-macOS-dmg-${{github.ref_name}}-${{github.sha}}" | |
STANDALONE_BUILD_PATH: "${{ github.workspace }}/UI/macOS/bin/Release/OCTOPUS RAW Player.app" | |
STANDALONE_BUILD_DIR: "${{ github.workspace }}/UI/macOS/bin/Release" | |
STANDALONE_BUILD_DMG_PATH: "${{ github.workspace }}/UI/macOS/bin/Release/OCTOPUS RAW Player" | |
STANDALONE_ARTIFACT_PATH: "${{ github.workspace }}/artifact/standalone" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: 'true' | |
- name: Read Version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: "${{ github.workspace }}/Version" | |
- name: Apply Version | |
shell: bash | |
run: | | |
./ApplyVersion.sh | |
dmg_path="${{ env.STANDALONE_BUILD_DMG_PATH }} ${{ steps.version.outputs.content }}.dmg" | |
echo "STANDALONE_BUILD_DMG_PATH=$dmg_path" >> $GITHUB_ENV | |
- name: "Import distribution certificate" | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
p12-file-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
p12-password: ${{ secrets.P12_PASSWORD }} | |
keychain-password: ${{ secrets.KEYCHAIN_PASSWORD }} | |
- name: "Build LJ92 decoder native library" | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: xcodebuild -workspace "${{env.DECODER_WORKSPACE_PATH}}" -scheme "LJ92" clean archive -configuration release -archivePath "${{env.DECODER_LJ92_ARCHIVE_PATH}}" | |
- name: "Build Unpack decoder native library" | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: xcodebuild -workspace "${{env.DECODER_WORKSPACE_PATH}}" -scheme "Unpack" clean archive -configuration release -archivePath "${{env.DECODER_UNPACK_ARCHIVE_PATH}}" | |
- name: Prepare decoder native libraries | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
mkdir -p ${{ env.DECODER_LJ92_LIB_PATH }} | |
mkdir -p ${{ env.DECODER_UNPACK_LIB_PATH }} | |
cp ${{env.DECODER_LJ92_ARCHIVE_PATH}}/Products/usr/local/lib/libLJ92.dylib ${{ env.DECODER_LJ92_LIB_PATH }} | |
cp ${{env.DECODER_UNPACK_ARCHIVE_PATH}}/Products/usr/local/lib/libUnpack.dylib ${{ env.DECODER_UNPACK_LIB_PATH }} | |
- name: Set Xamarin version | |
run: $VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --mac=8.12 | |
- name: Restore NuGet packages | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
- name: Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild ${{env.SOLUTION_FILE_PATH}} /t:Build /p:Configuration=Release /p:CreatePackage=false | |
#/p:ArchiveOnBuild=true | |
- name: Create .DMG | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
brew install graphicsmagick imagemagick | |
npm install --global create-dmg | |
create-dmg "${{ env.STANDALONE_BUILD_PATH }}" "${{ env.STANDALONE_BUILD_DIR }}" | |
#brew install create-dmg | |
#create-dmg --volname "OCTOPUS RAW Player (dev)" --icon "${{ env.STANDALONE_BUILD_PATH }}" 50 50 --app-drop-link 300 50 --hdiutil-verbose "${{ env.STANDALONE_BUILD_DMG_PATH }}" "${{ env.STANDALONE_BUILD_PATH }}" | |
- name: Notarize .DMG | |
run: | | |
xcrun notarytool store-credentials "AC_PASSWORD" --team-id "${{ secrets.NOTARIZATION_TEAM_ID }}" --apple-id "${{ secrets.NOTARIZATION_USERNAME }}" --password "${{ secrets.NOTARIZATION_PASSWORD }}" | |
xcrun notarytool submit "${{ env.STANDALONE_BUILD_DMG_PATH }}" --keychain-profile "AC_PASSWORD" --wait | |
xcrun stapler staple "${{ env.STANDALONE_BUILD_DMG_PATH }}" | |
- name: Prepare .DMG artifact | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
name="${{ env.BUILD_STANDALONE_ARTIFACT_NAME }}" | |
name=$(echo -n "$name" | sed -e 's/[ \t:\/\\"<>|*?]/-/g' -e 's/--*/-/g') | |
echo "BUILD_STANDALONE_ARTIFACT_NAME=$name" >> $GITHUB_ENV | |
- name: Upload .DMG artifact | |
uses: actions/upload-artifact@v3.1.0 | |
with: | |
name: ${{ env.BUILD_STANDALONE_ARTIFACT_NAME }} | |
path: ${{ env.STANDALONE_BUILD_DMG_PATH }} | |
if-no-files-found: error |