Skip to content

Commit

Permalink
Github Actions for Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jetelain committed Apr 12, 2024
1 parent 74cb25e commit efcbdef
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 0 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/release-dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Release for .NET Windows

on:
push:
branches: [ "*" ] # for testing purposes
release:
types: [published]

jobs:

build:

runs-on: windows-latest

env:
Solution_Name: ArmaRealMap.sln
Test_Project_Path: GameRealisticMap.Studio.Test\GameRealisticMap.Studio.Test.csproj
Wap_Project_Directory: GameRealisticMap.Studio.Package
Wap_Project_Path: GameRealisticMap.Studio.Package\GameRealisticMap.Studio.Package.wapproj

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Use Nerdbank.GitVersioning to set version variables
uses: dotnet/nbgv@master
id: nbgv

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Update manifest version
run: |
[xml]$manifest = get-content ".\$env:Wap_Project_Directory\Package.appxmanifest"
$manifest.Package.Identity.Version = "${{ steps.nbgv.outputs.SimpleVersion }}.0"
$manifest.Package.Identity.Publisher = "CN=ArmaRealMap GitHub Actions"
$manifest.save(".\$env:Wap_Project_Directory\Package.appxmanifest")
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=Release /p:Platform=x64 /p:RuntimeIdentifiers=win-x64

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: msbuild $env:Wap_Project_Path /p:Configuration=Release /p:UapAppxPackageBuildMode=StoreUpload /p:AppxBundle=Always /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} /p:Platform=x64 /p:FileVersion=${{ steps.nbgv.outputs.SimpleVersion }}

# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx

- name: Generate Test Package ZIP
run: Compress-Archive -Path ${{ env.Wap_Project_Directory }}\AppPackages\*_Test\* -DestinationPath GameRealisticMap.Studio.Package_Test.zip

# Generate Executable
- name: Build simple executable
run: dotnet publish -f net6.0-windows -r win-x64 -c Release GameRealisticMap.Studio/GameRealisticMap.Studio.csproj -o Output -p:FileVersion=${{ steps.nbgv.outputs.SimpleVersion }}

- name: Generate executable ZIP
run: Compress-Archive -Path Output\* -DestinationPath GameRealisticMap.Studio.zip

- name: Upload build artifacts (TEST)
uses: actions/upload-artifact@v3
with:
name: MSIX Test Package
path: |
GameRealisticMap.Studio.zip
GameRealisticMap.Studio.Package_Test.zip
${{ env.Wap_Project_Directory }}\AppPackages\*.appxupload
- uses: Shopify/upload-to-release@v1
with:
name: GameRealisticMap.Studio-${{ steps.nbgv.outputs.SimpleVersion }}.zip
path: GameRealisticMap.Studio.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}
content-type: application/zip

- uses: Shopify/upload-to-release@v1
with:
name: GameRealisticMap.Studio.Package_Test-${{ steps.nbgv.outputs.SimpleVersion }}.zip
path: GameRealisticMap.Studio.Package_Test.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}
content-type: application/zip






46 changes: 46 additions & 0 deletions .github/workflows/release-dotnet-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release for .NET Linux

on:
push:
branches: [ "*" ] # for testing purposes
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Use Nerdbank.GitVersioning to set version variables
uses: dotnet/nbgv@master
id: nbgv

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Build Linux Command Line
run: dotnet publish --no-self-contained -f net6.0 -r linux-x64 -c Release GameRealisticMap.Arma3.CommandLine/GameRealisticMap.Arma3.CommandLine.csproj -o Output -p:FileVersion=${{ steps.nbgv.outputs.SimpleVersion }}

- name: Generate tar.gz
run: tar -czvf grma3.tar.gz -C Output grma3

- name: Upload build artifacts (TEST)
uses: actions/upload-artifact@v3
with:
name: Linux Command Line
path: grma3.tar.gz

- uses: Shopify/upload-to-release@v1
with:
name: grma3-${{ steps.nbgv.outputs.SimpleVersion }}.tar.gz
path: grma3.tar.gz
repo-token: ${{ secrets.GITHUB_TOKEN }}
content-type: application/gzip

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,4 @@ healthchecksdb
*.bak
/PDrive/z/arm/addons/grm_demo_*
/GameRealisticMap.Arma3.CommandLine/Properties/launchSettings.json
/Output

0 comments on commit efcbdef

Please sign in to comment.