-
Notifications
You must be signed in to change notification settings - Fork 6
136 lines (133 loc) · 5.14 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: .Net8 CI/CD
on:
push:
tags:
- 'v*'
jobs:
test:
name: Debug Build & Test
runs-on: windows-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Setup .NET 8.0.*
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.*
- name: Clean
run: dotnet clean && dotnet nuget locals all --clear
- name: Build
run: dotnet build -c Debug
- name: Test
run: dotnet test
release:
name: Create Github Release
if: contains(github.ref, 'tags/v')
needs: [test]
runs-on: ubuntu-latest
outputs:
upload_url: ${{steps.create_release.outputs.upload_url}}
version: ${{steps.get-version.outputs.version}}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: true
- name: Version
id: get-version
run: |
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
echo "version=$VERSION" >> $GITHUB_OUTPUT
publish:
if: contains(github.ref, 'tags/v')
needs: [test, release]
runs-on: windows-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Setup .NET8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.*
- name: Download ffmpeg
shell: powershell
run: |
mkdir tmp -force
mkdir ffmpeg/bin
cd tmp
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest https://github.com/GyanD/codexffmpeg/releases/download/7.0.2/ffmpeg-7.0.2-full_build.zip -o ffbin.zip
Expand-Archive ffbin.zip -Force
$item = Get-Childitem -Recurse -Filter ffmpeg.exe
$item2 = Get-Childitem -Recurse -Filter ffprobe.exe
cd ..
move $item[0].Fullname ffmpeg/bin
move $item2[0].Fullname ffmpeg/bin
del tmp -r
- name: Build
shell: powershell
run: |
dotnet publish ./Niconicome/Niconicome.csproj -c Release -r win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true -o win-x64-sc
dotnet publish ./Niconicome/Niconicome.csproj -c Release -r win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained false -o win-x64
dotnet publish ./Niconicome/Niconicome.csproj -c Release -r win-x86 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true -o win-x86-sc
dotnet publish ./Niconicome/Niconicome.csproj -c Release -r win-x86 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained false -o win-x86
Copy-Item -Recurse ffmpeg/bin win-x64-sc
Copy-Item -Recurse ffmpeg/bin win-x64
Copy-Item -Recurse ffmpeg/bin win-x86-sc
Copy-Item -Recurse ffmpeg/bin win-x86
Compress-Archive -Path win-x64-sc -DestinationPath win-x64-sc.zip -CompressionLevel fastest
Compress-Archive -Path win-x64 -DestinationPath win-x64.zip -CompressionLevel fastest
Compress-Archive -Path win-x86-sc -DestinationPath win-x86-sc.zip -CompressionLevel fastest
Compress-Archive -Path win-x86 -DestinationPath win-x86.zip -CompressionLevel fastest
- name: Upload Release Asset(x64)
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./win-x64.zip
asset_name: niconicome-win-x64-${{ needs.release.outputs.version }}.zip
asset_content_type: application/zip
- name: Upload Release Asset(x64 self-contained)
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./win-x64-sc.zip
asset_name: niconicome-win-x64-self-contained-${{ needs.release.outputs.version }}.zip
asset_content_type: application/zip
- name: Upload Release Asset(x86)
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./win-x86.zip
asset_name: niconicome-win-x86-${{ needs.release.outputs.version }}.zip
asset_content_type: application/zip
- name: Upload Release Asset(x86 self-contained)
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./win-x86-sc.zip
asset_name: niconicome-win-x86-self-contained-${{ needs.release.outputs.version }}.zip
asset_content_type: application/zip