-
Notifications
You must be signed in to change notification settings - Fork 2
/
workflowgen.ts
58 lines (50 loc) · 1.79 KB
/
workflowgen.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const targetFramework = "net8.0";
const platformTemplateGen = (name: string, rid: string, platform: string) =>
`
# Build ${name}
- name: Build ${name}
if: matrix.platform == '${platform}'
run: dotnet publish --configuration Release --self-contained -p:PublishSingleFile=true -r ${rid}
#- name: ZIP ${name}
# if: matrix.platform == '${platform}'
# run: 7z a -tzip artifacts/efmig-${name}-Release.zip ./Efmig/bin/Release/${targetFramework}/${rid}/publish/*
- name: Upload ${name} artifacts
if: matrix.platform == '${platform}'
uses: actions/upload-artifact@v3
with:
name: efmig-${name}-Release
path: Efmig/bin/Release/${targetFramework}/${rid}/publish/
if-no-files-found: error
`;
const extraSteps = [
platformTemplateGen("win-x64", "win-x64", "windows-latest"),
platformTemplateGen("win-arm64", "win-arm64", "windows-latest"),
platformTemplateGen("linux-x64", "linux-x64", "ubuntu-latest"),
platformTemplateGen("linux-arm64", "linux-arm64", "ubuntu-latest"),
platformTemplateGen("osx-x64", "osx-x64", "macos-latest"),
platformTemplateGen("osx-arm64", "osx-arm64", "macos-latest"),
].join("");
const template = `
# Auto-generated by workflowgen.ts
# Do not edit manually.
name: build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: \${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK \${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
${extraSteps}
`.trim();
Deno.writeTextFile(".github/workflows/build.yml", template);