Update dotnet-publish.yml #4
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' # 使用する.NETのバージョン | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Get the version | |
id: get_version | |
run: | | |
VERSION=$(dotnet msbuild git-local-repository-listing/git-local-repository-listing.csproj -target:PrintVersion -property:Version) | |
echo "::set-output name=VERSION::$VERSION" | |
shell: bash | |
- name: Publish Runtime Dependent | |
run: | | |
dotnet publish git-local-repository-listing/git-local-repository-listing.csproj --configuration Release --output publish/runtime-dependent | |
zip -r runtime-dependent-${{ steps.get_version.outputs.VERSION }}.zip publish/runtime-dependent src/lepos.bash | |
- name: Publish Runtime Independent | |
run: | | |
dotnet publish git-local-repository-listing/git-local-repository-listing.csproj --configuration Release --output publish/runtime-independent --self-contained false | |
zip -r runtime-independent-${{ steps.get_version.outputs.VERSION }}.zip publish/runtime-independent src/lepos.bash | |
- name: Publish Windows Self-Contained (Trimmed) | |
run: | | |
dotnet publish git-local-repository-listing/git-local-repository-listing.csproj --configuration Release --output publish/windows-self-contained --runtime win-x64 --self-contained true /p:PublishTrimmed=true | |
zip -r windows-self-contained-${{ steps.get_version.outputs.VERSION }}.zip publish/windows-self-contained src/lepos.bash | |
- name: Publish Linux Self-Contained (Trimmed) | |
run: | | |
dotnet publish git-local-repository-listing/git-local-repository-listing.csproj --configuration Release --output publish/linux-self-contained --runtime linux-x64 --self-contained true /p:PublishTrimmed=true | |
zip -r linux-self-contained-${{ steps.get_version.outputs.VERSION }}.zip publish/linux-self-contained src/lepos.bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.get_version.outputs.VERSION }} | |
release_name: Release v${{ steps.get_version.outputs.VERSION }} | |
draft: false | |
prerelease: false | |
- name: Upload Runtime Dependent Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./runtime-dependent-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_name: runtime-dependent-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_content_type: application/zip | |
- name: Upload Runtime Independent Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./runtime-independent-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_name: runtime-independent-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_content_type: application/zip | |
- name: Upload Windows Self-Contained (Trimmed) Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./windows-self-contained-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_name: windows-self-contained-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_content_type: application/zip | |
- name: Upload Linux Self-Contained (Trimmed) Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./linux-self-contained-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_name: linux-self-contained-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_content_type: application/zip |