diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index b3726b2d..433067d5 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -1,5 +1,6 @@ name: Snap Hutao Alpha on: + workflow_dispatch: push: branches: - main @@ -14,7 +15,7 @@ on: jobs: publish-alpha: - runs-on: windows-latest + runs-on: self-hosted steps: - name: Checkout uses: actions/checkout@v4.1.1 @@ -25,23 +26,21 @@ jobs: dotnet-version: 8.0 - name: Cake + id: cake shell: pwsh run: dotnet tool restore && dotnet cake env: VERSION_API_TOKEN: ${{ secrets.VERSION_API_TOKEN }} - name: Sign Msix - id: signing - uses: skymatic/code-sign-action@v1 - with: - certificate: ${{ secrets.CERTIFICATE }} - password: ${{ secrets.PW }} - certificatename: DGP Studio CI - folder: src/output + shell: pwsh + run: | + [System.Convert]::FromBase64String("${{ secrets.CERTIFICATE }}") | Set-Content -AsByteStream temp.pfx + signtool.exe sign /debug /v /a /fd SHA256 /f temp.pfx /p ${{ secrets.PW }} ${{ github.workspace }}\src\output\Snap.Hutao.Alpha-${{ steps.cake.outputs.version }}.msix - name: Upload signed msix if: success() uses: actions/upload-artifact@v3 with: - name: Snap.Hutao.${{ steps.signing.outputs.version }} - path: ${{ github.workspace }}/app/build/outputs/apk/foss/release + name: Snap.Hutao.Alpha-${{ steps.cake.outputs.version }} + path: ${{ github.workspace }}/src/output/Snap.Hutao.Alpha-${{ steps.cake.outputs.version }}.msix diff --git a/build.cake b/build.cake index 1aec1425..0fdc7daf 100644 --- a/build.cake +++ b/build.cake @@ -50,7 +50,7 @@ if (AzurePipelines.IsRunningOnAzurePipelines) } else if (GitHubActions.IsRunningOnGitHubActions) { - repoDir = GitHubActions.Environment.Runner.Workspace.FullPath; + repoDir = GitHubActions.Environment.Workflow.Workspace.FullPath; outputPath = System.IO.Path.Combine(repoDir, "src", "output"); var versionAuth = HasEnvironmentVariable("VERSION_API_TOKEN") ? EnvironmentVariable("VERSION_API_TOKEN") : throw new Exception("Cannot find VERSION_API_TOKEN"); @@ -74,9 +74,9 @@ else if (AppVeyor.IsRunningOnAppVeyor) outputPath = System.IO.Path.Combine(repoDir, "src", "output"); version = XmlPeek(manifest, "appx:Package/appx:Identity/@Version", new XmlPeekSettings - { - Namespaces = new Dictionary { { "appx", "http://schemas.microsoft.com/appx/manifest/foundation/windows10" } } - })[..^2]; + { + Namespaces = new Dictionary { { "appx", "http://schemas.microsoft.com/appx/manifest/foundation/windows10" } } + })[..^2]; Information($"Version: {version}"); } @@ -92,11 +92,11 @@ Task("NuGet Restore") var nugetConfig = System.IO.Path.Combine(repoDir, "NuGet.Config"); DotNetRestore(project, new DotNetRestoreSettings - { - Verbosity = DotNetVerbosity.Detailed, - Interactive = false, - ConfigFile = nugetConfig - }); + { + Verbosity = DotNetVerbosity.Detailed, + Interactive = false, + ConfigFile = nugetConfig + }); }); Task("Generate AppxManifest") @@ -175,7 +175,7 @@ Task("Build MSIX") .Does(() => { var arguments = "arguments"; - if (AzurePipelines.IsRunningOnAzurePipelines) + if (AzurePipelines.IsRunningOnAzurePipelines || GitHubActions.IsRunningOnGitHubActions) { arguments = "pack /d " + binPath + " /p " + System.IO.Path.Combine(outputPath, $"Snap.Hutao.Alpha-{version}.msix"); }