Skip to content

Merge pull request #659 from Hayao-H/develop #87

Merge pull request #659 from Hayao-H/develop

Merge pull request #659 from Hayao-H/develop #87

Workflow file for this run

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