BililiveRecorder/.github/workflows/release.yml

114 lines
3.8 KiB
YAML
Raw Normal View History

2021-02-26 21:57:10 +08:00
name: Release
on:
release:
types: [published]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
2021-02-26 21:57:10 +08:00
jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore Packages
run: dotnet restore -v m
- name: Run Tests
run: dotnet test -v m
release_wpf:
needs: test
strategy:
matrix:
build_configuration: [Release]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
2021-02-26 22:30:10 +08:00
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
2021-02-26 21:57:10 +08:00
- name: Restore Packages
run: nuget restore -Verbosity quiet
- name: Build WPF
run: msbuild /nologo /v:m /p:Configuration="${{ matrix.build_configuration }}"
2021-05-14 17:08:37 +08:00
- name: Upload Build Artifacts
2021-02-26 21:57:10 +08:00
uses: actions/upload-artifact@v2
with:
name: WPF-${{ matrix.build_configuration }}
path: BililiveRecorder.WPF/bin/${{ matrix.build_configuration }}
2021-05-14 17:08:37 +08:00
- name: Upload Packed Artifacts
uses: actions/upload-artifact@v2
with:
name: WPF-NupkgReleases
path: BililiveRecorder.WPF/bin/NupkgReleases
- name: Pack Portable Zip File
2021-02-26 21:57:10 +08:00
run: 7z a BililiveRecorder-WPF-Portable.zip BililiveRecorder.WPF/bin/${{ matrix.build_configuration }}
2021-05-14 17:08:37 +08:00
- name: Upload Portable Zip File
2021-02-26 21:57:10 +08:00
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: BililiveRecorder-WPF-Portable.zip
asset_name: BililiveRecorder-WPF-Portable.zip
asset_content_type: application/zip
2021-05-14 17:08:37 +08:00
- name: Upload Installer
2021-02-26 21:57:10 +08:00
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: BililiveRecorder.WPF\bin\SquirrelReleases\Setup.exe
asset_name: BililiveRecorder-WPF-Setup.exe
asset_content_type: application/vnd.microsoft.portable-executable
release_cli:
needs: test
strategy:
matrix:
rid: [any, linux-arm, linux-arm64, linux-x64, osx-x64, win-x64]
build_configuration: [Release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore Packages
run: dotnet restore -v m
- name: Build CLI
if: ${{ matrix.rid == 'any' }}
2021-02-26 22:25:35 +08:00
run: dotnet publish -c ${{ matrix.build_configuration }} BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
2021-02-26 21:57:10 +08:00
- name: Build CLI
if: ${{ matrix.rid != 'any' }}
2021-02-26 22:25:35 +08:00
run: dotnet publish -c ${{ matrix.build_configuration }} -r ${{ matrix.rid }} BililiveRecorder.Cli/BililiveRecorder.Cli.csproj
2021-02-26 21:57:10 +08:00
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: CLI-${{ matrix.rid }}-${{ matrix.build_configuration }}
2021-02-26 22:41:03 +08:00
path: BililiveRecorder.Cli/publish/${{ matrix.rid }}
2021-02-26 21:57:10 +08:00
- name: Pack Release Asset
run: |
cd BililiveRecorder.Cli/publish
2021-02-26 22:41:03 +08:00
zip -r CLI-${{ matrix.rid }}-${{ matrix.build_configuration }}.zip ./${{ matrix.rid }}
2021-02-26 21:57:10 +08:00
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
2021-02-26 22:41:03 +08:00
asset_path: BililiveRecorder.Cli/publish/CLI-${{ matrix.rid }}-${{ matrix.rid }}.zip
2021-02-26 21:57:10 +08:00
asset_name: BililiveRecorder-CLI-${{ matrix.rid }}.zip
asset_content_type: application/zip