From a65cec8dd4c1d96c80e44e1bb60d7fd074d2f25c Mon Sep 17 00:00:00 2001 From: Sharp0802 Date: Thu, 26 Sep 2024 14:14:07 +0900 Subject: [PATCH] :rocket: #103: Add github-actions script to create release automatically --- .github/workflows/dotnet.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b4cc771..414110c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ "master" ] +permissions: + contents: write + jobs: build: @@ -33,4 +36,20 @@ jobs: PROJECT_FILE_PATH: "src/sika/sika.csproj" VERSION_REGEX: '(.*)<\/AssemblyVersion>' NUGET_KEY: ${{secrets.NUGET_KEY}} - if: github.event_name != 'pull_request' \ No newline at end of file + if: github.event_name != 'pull_request' + + - name: Retrieve version + id: proj_version + uses: KageKirin/get-csproj-version@v0 + with: + file: src/sika/sika.csproj + xpath: '//PropertyGroup/AssemblyVersion' + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.proj_version.version }} + run: | + gh release create "v$VERSION" \ + --repo="$GITHUB_REPOSITORY" \ + --generate-notes \ No newline at end of file