mirror of
https://github.com/izzy2lost/RetroPass.git
synced 2026-03-26 16:42:34 -07:00
122 lines
5.1 KiB
YAML
122 lines
5.1 KiB
YAML
name: RetroPass Build
|
|
|
|
# Controls when the workflow will run
|
|
on:
|
|
# Triggers the workflow on tag event
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
# This workflow contains a single job called "build"
|
|
build:
|
|
# The type of runner that the job will run on
|
|
runs-on: windows-latest
|
|
|
|
env:
|
|
SolutionPath: RetroPass.sln
|
|
Platform: x64
|
|
Configuration: Release
|
|
BuildMode: SideLoadOnly
|
|
AppxBundle: Never
|
|
SigningCertificate: RetroPassKey.pfx
|
|
ProjectPath: RetroPass\RetroPass.csproj
|
|
ProjectDirectory: .\RetroPass
|
|
PackageOutputRootDir: C:\AppPackage
|
|
PackageOutputDir: RetroPass
|
|
PackageOutputBaseName: RetroPass
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
- name: Add msbuild to PATH
|
|
uses: microsoft/setup-msbuild@v1
|
|
|
|
- name: Setup NuGet.exe for use with actions
|
|
uses: NuGet/setup-nuget@v1.0.5
|
|
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
|
|
# Get tag name so a proper package name can be generated
|
|
- name: Get tag
|
|
id: getTag
|
|
# You may pin to the exact commit or the version.
|
|
uses: dawidd6/action-get-tag@v1.1.0
|
|
|
|
# Create package name
|
|
- name: GetPackageName
|
|
id: getPackageName
|
|
run: |
|
|
$PackageName = "${{ env.PackageOutputBaseName }}" + "_" + "${{ steps.getTag.outputs.tag }}"
|
|
echo "::set-output name=PackageName::$PackageName"
|
|
Write-Host "Package Name is $PackageName"
|
|
|
|
# Decode the Base64 encoded Pfx
|
|
- name: Decode the Pfx
|
|
run: |
|
|
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}")
|
|
$currentDirectory = Get-Location
|
|
$certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:ProjectDirectory -AdditionalChildPath $env:SigningCertificate
|
|
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
|
|
|
|
# Build app
|
|
- name: App build
|
|
run: msbuild $env:SolutionPath
|
|
/p:Platform=$env:Platform
|
|
/p:Configuration=$env:Configuration
|
|
/p:UapAppxPackageBuildMode=$env:BuildMode
|
|
/p:AppxBundle=$env:AppxBundle
|
|
/p:PackageCertificateKeyFile=$env:SigningCertificate
|
|
/p:PackageCertificatePassword=${{ secrets.PFX_KEY_PASSWORD }}
|
|
/p:AppxPackageTestDir="${{ env.PackageOutputRootDir }}\${{steps.getPackageName.outputs.PackageName}}\"
|
|
/restore
|
|
|
|
# Remove the .pf
|
|
- name: Remove the .pfx
|
|
run: Remove-Item -path $env:ProjectDirectory/$env:SigningCertificate
|
|
|
|
# Clean the package
|
|
- name: Clean package
|
|
run: |
|
|
$PackagePath = "${{ env.PackageOutputRootDir }}\${{steps.getPackageName.outputs.PackageName}}"
|
|
Remove-Item -Recurse -path $PackagePath/Add-AppDevPackage.resources
|
|
Remove-Item -Recurse -path $PackagePath/TelemetryDependencies
|
|
Remove-Item -Recurse -path $PackagePath/Dependencies/arm
|
|
Remove-Item -Recurse -path $PackagePath/Dependencies/arm64
|
|
Remove-Item -Recurse -path $PackagePath/Dependencies/x86
|
|
Remove-Item -path $PackagePath/Add-AppDevPackage.ps1
|
|
Remove-Item -Recurse -path $PackagePath/Install.ps1
|
|
|
|
# Archive the package
|
|
- name: Create archive
|
|
run: |
|
|
$PackagePath = "${{ env.PackageOutputRootDir }}\${{steps.getPackageName.outputs.PackageName}}"
|
|
Compress-Archive -Path $PackagePath\* -DestinationPath "$PackagePath.zip"
|
|
dir "${{ env.PackageOutputRootDir }}"
|
|
|
|
# Create the release: https://github.com/actions/create-release
|
|
- name: Create release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
|
with:
|
|
tag_name: ${{steps.getPackageName.outputs.PackageName}}
|
|
release_name: ${{steps.getPackageName.outputs.PackageName}}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
# Upload release asset: https://github.com/actions/upload-release-asset
|
|
- name: Update release asset
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
|
asset_path: ${{ env.PackageOutputRootDir }}\${{steps.getPackageName.outputs.PackageName}}.zip
|
|
asset_name: ${{steps.getPackageName.outputs.PackageName}}.zip
|
|
asset_content_type: application/zip
|