diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml new file mode 100644 index 00000000..b3726b2d --- /dev/null +++ b/.github/workflows/alpha.yml @@ -0,0 +1,47 @@ +name: Snap Hutao Alpha +on: + push: + branches: + - main + - develop + paths-ignore: + - '.gitattributes' + - '.github/**' + - '.gitignore' + - '.gitmodules' + - '**.md' + - 'LICENSE' + +jobs: + publish-alpha: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: Setup .NET + uses: actions/setup-dotnet@v4.0.0 + with: + dotnet-version: 8.0 + + - name: 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 + + - 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 diff --git a/build.cake b/build.cake index 26a16afc..1aec1425 100644 --- a/build.cake +++ b/build.cake @@ -48,6 +48,26 @@ if (AzurePipelines.IsRunningOnAzurePipelines) AzurePipelines.Commands.SetVariable("version", version); } +else if (GitHubActions.IsRunningOnGitHubActions) +{ + repoDir = GitHubActions.Environment.Runner.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"); + version = HttpGet( + "https://internal.snapgenshin.cn/BuildIntergration/RequestNewVersion", + new HttpSettings + { + Headers = new Dictionary + { + { "Authorization", versionAuth } + } + } + ); + Information($"Version: {version}"); + + GitHubActions.Commands.SetOutputParameter("version", version); +} else if (AppVeyor.IsRunningOnAppVeyor) { repoDir = AppVeyor.Environment.Build.Folder; @@ -86,7 +106,7 @@ Task("Generate AppxManifest") var content = System.IO.File.ReadAllText(manifest); - if (AzurePipelines.IsRunningOnAzurePipelines) + if (AzurePipelines.IsRunningOnAzurePipelines || GitHubActions.IsRunningOnGitHubActions) { Information("Using CI configuraion"); content = content