From e10f412672d9add871824c999a9b06e987ad7e69 Mon Sep 17 00:00:00 2001 From: PolinaSavelyeva <113545874+PolinaSavelyeva@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:22:17 +0500 Subject: [PATCH] Use GitHub Environments for Nuget Publish (#285) * Fix nuget publish * Update library's README --- Content/Library/.github/workflows/publish.yml | 2 ++ Content/Library/README.md | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Content/Library/.github/workflows/publish.yml b/Content/Library/.github/workflows/publish.yml index 4e46a4d3..35c0fb6b 100644 --- a/Content/Library/.github/workflows/publish.yml +++ b/Content/Library/.github/workflows/publish.yml @@ -11,6 +11,8 @@ jobs: # Sets permissions of the GITHUB_TOKEN to allow release creating permissions: contents: write + environment: + name: nuget runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/Content/Library/README.md b/Content/Library/README.md index 94a66533..c7c49c1d 100644 --- a/Content/Library/README.md +++ b/Content/Library/README.md @@ -103,9 +103,9 @@ git remote add origin https://github.com/MyGithubUsername/MyLib.1.git git push -u origin MyReleaseBranch ``` -- [Create your NuGeT API key](https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-api-keys) - - Add your NuGet API key as repository secret NUGET_TOKEN to [Actions secrets](https://github.com/MyGithubUsername/MyLib.1/settings/secrets/actions) - +- [Create an Environment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#creating-an-environment) on your repository named `nuget`. +- [Create a NuGet API key](https://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-an-api-key) +- Add your `NUGET_TOKEN` to the [Environment Secrets](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-secrets) of your newly created environment. - Then update the `CHANGELOG.md` with an "Unreleased" section containing release notes for this version, in [KeepAChangelog](https://keepachangelog.com/en/1.1.0/) format. NOTE: Its highly recommend to add a link to the Pull Request next to the release note that it affects. The reason for this is when the `RELEASE` target is run, it will add these new notes into the body of git commit. GitHub will notice the links and will update the Pull Request with what commit referenced it saying ["added a commit that referenced this pull request"](https://github.com/TheAngryByrd/MiniScaffold/pull/179#ref-commit-837ad59). Since the build script automates the commit message, it will say "Bump Version to x.y.z". The benefit of this is when users goto a Pull Request, it will be clear when and which version those code changes released. Also when reading the `CHANGELOG`, if someone is curious about how or why those changes were made, they can easily discover the work and discussions.