Release #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "release" | |
env: | |
NUGET_REPO_URL: "https://api.nuget.org/v3/index.json" | |
VERSION: 1.6.11.${{ github.run_number }} | |
jobs: | |
publish: | |
name: 🚚 Prepare new release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Sets environment variables - branch-name | |
uses: nelonoel/[email protected] | |
- name: Sets environment variables - Nerdbank.GitVersioning | |
uses: dotnet/nbgv@master | |
with: | |
setAllVars: true | |
- name: Build | |
run: dotnet build -c Release OasReader.sln -p:UseSourceLink=true -p:PackageVersion="${{ env.VERSION }}" -p:Version="${{ env.VERSION }}" | |
- name: Move packages | |
shell: pwsh | |
run: Get-ChildItem -Filter *.nupkg -Recurse | ForEach-Object { Move-Item -Path $_ -Destination . } | |
- name: Publish artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Packages | |
path: | | |
**/*.nupkg | |
README.md | |
- name: Push packages to NuGet | |
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_REPO_URL }} --no-symbols | |
- name: Create tag | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ env.VERSION }}", | |
sha: context.sha | |
}) |