From 34a807d064c1d6dabef6d4d440ec549ca6d44f9c Mon Sep 17 00:00:00 2001 From: Lucas Girouard-Stranks <519592+lithiumtoast@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:43:43 -0400 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c43a7b94..e0889173 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: inputs: upload-nuget-packages: - description: 'Is this a release-candidate? (Candidates get uploaded to MyGet.org instead of NuGet.org)' + description: 'Is this a release candidate (pre-release)? (NOTE: candidates get uploaded to MyGet.org instead of NuGet.org)' required: true default: 'true' schedule: @@ -16,9 +16,11 @@ jobs: uses: "./.github/workflows/build.yml" release-job: - name: "Release .NET solution" + name: "Release" needs: [build-job] runs-on: ubuntu-latest + permissions: + contents: write steps: - name: "Clone Git repository" @@ -26,6 +28,17 @@ jobs: with: submodules: "recursive" + - name: "Set version" + id: set-version + shell: bash + run: | + IS_PRERELEASE="${{ github.event.inputs.pre-release }}" + if [[ "$IS_PRERELEASE" = "true" ]]; then + echo "VERSION=$(date +'%Y.%m.%d')-rc" >> "$GITHUB_OUTPUT" + else + echo "VERSION=$(date +'%Y.%m.%d')" >> "$GITHUB_OUTPUT" + fi + - name: "Download native libraries (win-x64)" uses: actions/download-artifact@v1 with: @@ -44,12 +57,8 @@ jobs: name: "native-libraries-linux-x64" path: "./lib" - - name: "Set package version" - id: set-package-version - run: echo "PACKAGE_VERSION=$(date +'%Y.%m.%d')" >> "$GITHUB_OUTPUT" - - name: ".NET pack" - run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="${{ steps.set-package-version.outputs.PACKAGE_VERSION }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}" + run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="${{ steps.set-version.outputs.VERSION }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}" - name: "Upload packages to MyGet" if: github.event_name == 'workflow_dispatch' && github.event.inputs.pre-release == 'true' @@ -58,7 +67,14 @@ jobs: run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://www.myget.org/F/bottlenoselabs/api/v3/index.json --skip-duplicate --api-key $MYGET_ACCESS_TOKEN - name: "Upload packages to NuGet" - if: github.event_name == 'schedule' || github.event.inputs.pre-release != 'false' + if: github.event_name == 'schedule' || github.event.inputs.pre-release != 'true' env: NUGET_ACCESS_TOKEN: ${{ secrets.NUGET_ACCESS_TOKEN }} run: dotnet nuget push "./nupkg/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_ACCESS_TOKEN + + - uses: ncipollo/release-action@v1 + with: + generateReleaseNotes: true + makeLatest: true + prerelease: "{{ github.event.inputs.pre-release == 'true' }}" + tag: "v${{ steps.set-version.outputs.VERSION }}"