FastGithub/.github/workflows/release.yml
2021-07-25 14:06:33 +08:00

66 lines
2.3 KiB
YAML

name: Release
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
os: [win-x64, linux-x64, osx-x64]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET 3.0 for gitreleasemanager
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.x
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- name: Setup .NET 5.0 for Release Manager
uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.9
with:
versionSpec: 5.x
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.9
with:
useConfigFile: true
- name: Restore dependencies
run: |
cd $GITHUB_WORKSPACE/src
dotnet restore
- name: Build
run: |
cd $GITHUB_WORKSPACE/src
dotnet publish FastGithub -c Release -f net6.0 /p:PublishSingleFile=true /p:PublishTrimmed=true -r ${{ matrix.os }} /p:PublishTrimmed=true -p:AssemblyVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} -p:Version=${{ steps.gitversion.outputs.SemVer }} -o ./out/${{ matrix.os }}
mv out/${{ matrix.os }} FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}
zip -r FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}.zip FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}
- uses: gittools/actions/gitreleasemanager/setup@v0.9.2
name: Install GitReleaseManager
with:
versionSpec: "0.11.x"
- uses: gittools/actions/gitreleasemanager/addasset@v0.9.2
name: Add asset to a release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: "newbe36524"
repository: "FastGithub"
tagName: "v${{ steps.gitversion.outputs.MajorMinorPatch }}"
assets: |
src/FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}.zip