-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (58 loc) · 2.75 KB
/
release.yml
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
name: release
on:
release:
types: [created]
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.305
- name: Checkout source
uses: actions/checkout@v3
- name: Prepare publish artifacts
run: |
dotnet publish CentCom.API -o publish/linux-x64/CentCom.API/ -r "linux-x64" --self-contained false -c Release --nologo
7z a publish/CentCom.API-linux-x64.7z -r ./publish/linux-x64/CentCom.API/*
dotnet publish CentCom.Server -o publish/linux-x64/CentCom.Server -r "linux-x64" --self-contained false -c Release --nologo
7z a publish/CentCom.Server-linux-x64.7z -r ./publish/linux-x64/CentCom.Server/*
dotnet publish CentCom.Exporter -o publish/linux-x64/CentCom.Exporter -r "linux-x64" --self-contained false -c Release --nologo
7z a publish/CentCom.Exporter-linux-x64.7z -r ./publish/linux-x64/CentCom.Exporter/*
dotnet publish CentCom.API -o publish/win-x64/CentCom.API/ -r "win-x64" --self-contained false -c Release --nologo
7z a publish/CentCom.API-win-x64.7z -r ./publish/win-x64/CentCom.API/*
dotnet publish CentCom.Server -o publish/win-x64/CentCom.Server -r "win-x64" --self-contained false -c Release --nologo
7z a publish/CentCom.Server-win-x64.7z -r ./publish/win-x64/CentCom.Server/*
dotnet publish CentCom.Exporter -o publish/win-x64/CentCom.Exporter -r "win-x64" --self-contained false -c Release --nologo
7z a publish/CentCom.Exporter-win-x64.7z -r ./publish/win-x64/CentCom.Exporter/*
- name: Upload release artifacts
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const tag = context.ref.replace("refs/tags/", "");
console.log("tag = ", tag);
// Get release for this tag
const release = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag
});
const releaseRuntimes = ['linux-x64', 'win-x64'];
const projects = ['CentCom.API', 'CentCom.Server', 'CentCom.Exporter'];
for (rt of releaseRuntimes) {
for (proj of projects) {
// Upload the release asset
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `${proj}-${rt}.7z`,
data: fs.readFileSync(`publish/${proj}-${rt}.7z`)
});
}
}