Update release.yml #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
determine-version: | |
runs-on: windows-latest | |
outputs: | |
semVer: ${{ steps.nbgv.outputs.SemVer2 }} | |
simpleVer: ${{ steps.nbgv.outputs.SimpleVersion }} | |
revision: ${{ steps.nbgv.outputs.VersionRevision }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Nerdbank.GitVersioning | |
id: nbgv | |
uses: dotnet/[email protected] | |
build-executable: | |
needs: [determine-version] | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
rid: [linux_x64, win_x64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Restore | |
run: ./build.cmd Restore | |
- name: Publish | |
run: ./build.cmd Publish --runtime ${{matrix.rid}} --skip Restore | |
- if: ${{ matrix.rid == 'linux_x64' }} | |
name: Download libOpenCvSharpExtern.so | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
$TFM = dotnet msbuild --getProperty:TargetFramework src/Beutl/Beutl.csproj | |
$Packages = dotnet list src/Beutl.Engine/Beutl.Engine.csproj package --framework $TFM --format json | |
#4.9.0.2024 | |
$OpenCvSharpVersion = (echo $Packages | jq -r '.projects[0].frameworks[0].topLevelPackages | map(select(.id == "OpenCvSharp4"))[0].requestedVersion') | |
#4.9.0 | |
$OpenCvVersion = [System.String]::Join('.', [System.Linq.Enumerable]::Take($OpenCvSharpVersion.Split('.'), 3)) | |
#GitのタグとNuGetのバージョンが違う場合があるので | |
$Filter = 'map(select(.tag_name | startswith("'+$OpenCvVersion+'")))[0].tag_name' | |
$OpenCvSharpTag = (gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/shimat/opencvsharp/releases | jq -r $Filter) | |
#ダウンロード | |
$Release = (gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/indigo-san/opencvsharp-extern-builds/releases/tags/$OpenCvSharpTag) | |
$AssetId = (echo $Release | jq '.assets | map(select(.name == "libOpenCvSharpExtern.so"))[0].id') | |
cd output/Beutl | |
gh api -H "Accept: application/octet-stream" -H "X-GitHub-Api-Version: 2022-11-28" /repos/indigo-san/opencvsharp-extern-builds/releases/assets/$AssetId > libOpenCvSharpExtern.so | |
- name: Zip | |
run: ./build.cmd Zip --runtime ${{matrix.rid}} --skip Publish | |
- name: Save | |
uses: actions/upload-artifact@v3 | |
with: | |
name: beutl-${{matrix.rid}}-${{needs.determine-version.outputs.semVer}} | |
path: ./artifacts/*.zip | |
build-windows-installer: | |
needs: [determine-version, build-executable] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- uses: actions/download-artifact@v3 | |
with: | |
name: beutl-win_x64-${{needs.determine-version.outputs.semVer}} | |
path: artifacts | |
- name: Extract zip | |
run: | | |
mkdir output/Beutl | |
cd output/Beutl | |
7z x ../../artifacts/beutl-win-x64-${{needs.determine-version.outputs.semVer}}.zip | |
- name: Build installer | |
run: ./build.cmd BuildInstaller --skip Publish | |
- name: Save installer | |
uses: actions/upload-artifact@v3 | |
with: | |
name: beutl-setup | |
path: ./artifacts/beutl-setup.exe | |
build-debian-package: | |
needs: [determine-version, build-executable] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- uses: actions/download-artifact@v3 | |
with: | |
name: beutl-linux_x64-${{needs.determine-version.outputs.semVer}} | |
path: artifacts | |
- name: Extract zip | |
run: | | |
cd packages/ubuntu22.04_amd64/usr | |
mkdir -p lib/beutl | |
cd lib/beutl | |
unzip ${{ github.workspace }}/artifacts/Beutl-linux-x64-${{needs.determine-version.outputs.semVer}}.zip | |
- name: Change mode | |
run: | | |
cd packages/ubuntu22.04_amd64/usr/lib/beutl | |
chmod +x Beutl | |
chmod +x Beutl.ExceptionHandler | |
chmod +x Beutl.PackageTools | |
chmod +x Beutl.WaitingDialog | |
- name: Symbolic Link | |
run: | | |
cd packages/ubuntu22.04_amd64 | |
mkdir usr/bin | |
ln -s /usr/lib/beutl/Beutl usr/bin/beutl | |
ln -s /usr/lib/beutl/Beutl.PackageTools usr/bin/beutl-pkg | |
- name: Set Version | |
run: | | |
cd packages/ubuntu22.04_amd64/DEBIAN | |
echo "Version: ${{needs.determine-version.outputs.simpleVer}}-${{needs.determine-version.outputs.revision}}ubuntu22.04" >> control | |
- name: Set Installed-Size | |
run: | | |
SizeInKiloBytes=`du -s -k packages/ubuntu22.04_amd64 | awk '{print $1}'` | |
cd packages/ubuntu22.04_amd64/DEBIAN | |
echo "Installed-Size: $SizeInKiloBytes" >> control | |
- name: Build package | |
run: | | |
cd packages | |
fakeroot dpkg-deb --build ubuntu22.04_amd64 . | |
- name: Save package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: beutl-setup | |
path: ./packages/beutl_${{needs.determine-version.outputs.simpleVer}}-${{needs.determine-version.outputs.revision}}ubuntu22.04_amd64.deb | |
build-nuget: | |
needs: [determine-version] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Restore | |
run: ./build.cmd Restore | |
- name: Build & Pack | |
run: dotnet pack --no-restore -c Release --output ../../artifacts | |
working-directory: ./packages/Beutl.Sdk | |
- name: Save | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Beutl.Sdk.${{needs.determine-version.outputs.semVer}} | |
path: ./artifacts/Beutl.Sdk.${{needs.determine-version.outputs.semVer}}.nupkg | |
create-release: | |
needs: [build-executable, build-windows-installer, build-debian-package, build-nuget] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- uses: ncipollo/release-action@v1 | |
id: create_release | |
with: | |
artifacts: "artifacts/**/*.zip,artifacts/**/*.nupkg,artifacts/**/*.deb,artifacts/beutl-setup.exe" | |
draft: true | |
makeLatest: true | |
generateReleaseNotes: true |