migrate to GitHub actions

This commit is contained in:
qhy040404
2023-12-12 18:14:23 +08:00
parent c67dfea819
commit 0b7b259d2f
2 changed files with 68 additions and 1 deletions

47
.github/workflows/alpha.yml vendored Normal file
View File

@@ -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

View File

@@ -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<string, string>
{
{ "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