From af2d08ea6fdb6aceb9bd5640109f675168a61ef5 Mon Sep 17 00:00:00 2001 From: Taku Izumi Date: Sat, 13 Apr 2024 19:01:06 +0900 Subject: [PATCH] ci: release workflow This patch adds GitHub Actions workflow to release and publish NuGet package. Signed-off-by: Taku Izumi --- .github/workflows/release.yaml | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..59ef01c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,43 @@ +name: Release-and-Publish + +on: + release: + types: [published] + +jobs: + release: + name: release-build + runs-on: ubuntu-latest + steps: + # Checkout git repository + # https://github.com/actions/checkout + - name: Checkout + uses: actions/checkout@v4 + + # Set up dotnet CLI + # https://github.com/actions/setup-dotnet + - name: Setup .NET CLI + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.x + + # Build NuGet package for template + - name: Build NuGet package + run: dotnet pack + + # Zip artifacts + - name: Zip artifacts + run: | + zip -j Kgh02017.Templates.editorconfig-${{github.ref_name}}.zip ./bin/Release/*.nupkg + + # Upload release Assets + # https://github.com/AButler/upload-release-assets + - uses: AButler/upload-release-assets@v3.0 + with: + files: Kgh02017.Templates.editorconfig-${{github.ref_name}}.zip + repo-token: ${{ secrets.GITHUB_TOKEN }} + release-tag: ${{github.ref_name}} + + # Publish to NuGet.org + - run: | + dotnet nuget push ./bin/Release/*.nupkg -n true -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json