fix https://ranobelib.me/ #604
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: .NET | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c release | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Small | |
run: > | |
dotnet publish -c release -p:PublishDir=../dist/small --no-self-contained | |
-p:PublishSingleFile=true -p:DebugType=embedded -p:PublishTrimmed=false | |
-p:EnableCompressionInSingleFile=false --use-current-runtime | |
- name: Portable | |
run: > | |
dotnet publish -c release -p:PublishDir=../dist/portable --self-contained | |
-p:PublishSingleFile=true -p:DebugType=embedded -p:PublishTrimmed=true -p:TrimMode=partial | |
-p:EnableCompressionInSingleFile=true --use-current-runtime | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Elib2Ebook-${{ matrix.os }} | |
path: ${{ github.workspace }}/dist/small | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Elib2Ebook-${{ matrix.os }}-portable | |
path: ${{ github.workspace }}/dist/portable | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: kzrnm/get-net-sdk-project-versions-action@v1 | |
id: get-version | |
with: | |
proj-path: Elib2Ebook/Elib2Ebook.csproj | |
- name: "get-last-release" | |
id: last_release | |
uses: InsonusK/[email protected] | |
with: | |
myToken: ${{ github.token }} | |
- name: release | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: false | |
prerelease: false | |
release_name: ${{steps.get-version.outputs.version}} | |
tag_name: ${{steps.get-version.outputs.version}} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: download-artifact-ubuntu | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: Elib2Ebook-ubuntu-latest | |
path: ${{ github.workspace }}/linux | |
- name: download-artifact-ubuntu-portable | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: Elib2Ebook-ubuntu-latest-portable | |
path: ${{ github.workspace }}/linux-portable | |
- name: download-artifact-windows | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: Elib2Ebook-windows-latest | |
path: ${{ github.workspace }}/windows | |
- name: download-artifact-windows-portable | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: Elib2Ebook-windows-latest-portable | |
path: ${{ github.workspace }}/windows-portable | |
- name: download-artifact-macos | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: Elib2Ebook-macos-latest | |
path: ${{ github.workspace }}/macos | |
- name: download-artifact-macos-portable | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: Elib2Ebook-macos-latest-portable | |
path: ${{ github.workspace }}/macos-portable | |
- name: Install zip | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: montudor/[email protected] | |
- name: Zip output | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
run: zip -qq -x "*.pdb" -r ../Elib2Ebook-Linux.zip . | |
working-directory: ${{ github.workspace }}/linux | |
- name: Zip output | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
run: zip -qq -x "*.pdb" -r ../Elib2Ebook-Linux-portable.zip . | |
working-directory: ${{ github.workspace }}/linux-portable | |
- name: Zip output | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
run: zip -qq -x "*.pdb" -r ../Elib2Ebook-Windows.zip . | |
working-directory: ${{ github.workspace }}/windows | |
- name: Zip output | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
run: zip -qq -x "*.pdb" -r ../Elib2Ebook-Windows-portable.zip . | |
working-directory: ${{ github.workspace }}/windows-portable | |
- name: Zip output | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
run: zip -qq -x "*.pdb" -r ../Elib2Ebook-Macos.zip . | |
working-directory: ${{ github.workspace }}/macos | |
- name: Zip output | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
run: zip -qq -x "*.pdb" -r ../Elib2Ebook-Macos-portable.zip . | |
working-directory: ${{ github.workspace }}/macos-portable | |
- name: upload linux artifact | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Elib2Ebook-Linux.zip | |
asset_name: Elib2Ebook-Linux.zip | |
asset_content_type: application/zip | |
- name: upload windows artifact | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Elib2Ebook-Windows.zip | |
asset_name: Elib2Ebook-Windows.zip | |
asset_content_type: application/zip | |
- name: upload macos artifact | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Elib2Ebook-Macos.zip | |
asset_name: Elib2Ebook-Macos.zip | |
asset_content_type: application/zip | |
- name: upload linux artifact portable | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Elib2Ebook-Linux-portable.zip | |
asset_name: Elib2Ebook-Linux-portable.zip | |
asset_content_type: application/zip | |
- name: upload windows artifact portable | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Elib2Ebook-Windows-portable.zip | |
asset_name: Elib2Ebook-Windows-portable.zip | |
asset_content_type: application/zip | |
- name: upload macos artifact portable | |
if: ${{ steps.last_release.outputs.tag_name != steps.get-version.outputs.version }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Elib2Ebook-Macos-portable.zip | |
asset_name: Elib2Ebook-Macos-portable.zip | |
asset_content_type: application/zip |