prepare release 2.5.0 #29
Workflow file for this run
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: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' | |
jobs: | |
release: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
environment: deployment | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get tag | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Verify tag | |
run: | | |
VERSION=$(grep '<Version>' Analytics-CSharp/Analytics-CSharp.csproj | sed "s@.*<Version>\(.*\)</Version>.*@\1@") | |
if [ "${{ steps.vars.outputs.tag }}" != "$VERSION" ]; then { | |
echo "Tag ${{ steps.vars.outputs.tag }} does not match the package version ($VERSION)" | |
exit 1 | |
} fi | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
6.0.x | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: Pack | |
run: dotnet pack | |
- name: Publish | |
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
- name: Create release | |
run: | | |
curl \ | |
-X POST \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/repos/${{github.repository}}/releases \ | |
-d '{"tag_name": "${{ env.RELEASE_VERSION }}", "name": "${{ env.RELEASE_VERSION }}", "body": "Release of version ${{ env.RELEASE_VERSION }}", "draft": false, "prerelease": false, "generate_release_notes": true}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} |