Updating build CI to upload nugets to tagged github releases. (#203)

* enabling release publish

* addign script to get tag version

* Updating workflow

* updating workflow

* updating workflow

* updating workflow

* switching to ubuntu

* updating patht o nugets

* updating workflow

* updating workflow

* Updating workflow

* updating workflow

* Updating workflow.

* Update sdk_build.yml

* clean up

* add body

Co-authored-by: Young Bu Park <youngp@microsoft.com>
This commit is contained in:
Aman Bhardwaj 2020-01-16 16:18:40 -08:00 committed by GitHub
parent b02aa3f02b
commit ea0c4436f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 12 deletions

30
.github/scripts/get_release_version.py vendored Normal file
View File

@ -0,0 +1,30 @@
# ------------------------------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------------------------------
# This script parses release version from Git tag and set the parsed version to
# environment variable, REL_VERSION.
import os
import sys
gitRef = os.getenv("GITHUB_REF")
tagRefPrefix = "refs/tags/v"
if gitRef is None or not gitRef.startswith(tagRefPrefix):
print ("##[set-env name=REL_VERSION;]edge")
print ("This is daily build from {}...".format(gitRef))
sys.exit(0)
releaseVersion = gitRef[len(tagRefPrefix):]
releaseNotePath="docs/release_notes/v{}.md".format(releaseVersion)
if gitRef.find("-rc.") > 0:
print ("Release Candidate build from {}...".format(gitRef))
else:
# Set LATEST_RELEASE to true
print ("##[set-env name=LATEST_RELEASE;]true")
print ("Release build from {}...".format(gitRef))
print ("##[set-env name=REL_VERSION;]{}".format(releaseVersion))

View File

@ -16,24 +16,47 @@ on:
jobs:
build:
name: Build Projects
runs-on: windows-latest
strategy:
matrix:
configuration: [release, debug]
runs-on: ubuntu-latest
env:
NUPKG_OUTDIR: bin/Release/nugets
steps:
- uses: actions/checkout@v1
- name: Parse release version
run: python ./.github/scripts/get_release_version.py
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Build solution - ${{ matrix.configuration }}
run: dotnet build all.sln --configuration ${{ matrix.configuration }}
- name: Test solution - ${{ matrix.configuration }}
run: dotnet test test/test.sln --configuration ${{ matrix.configuration }}
- name: Generate Nuget Packages - ${{ matrix.configuration }}
run: dotnet pack src/prod.sln --configuration ${{ matrix.configuration }} --include-symbols --no-build
- name: Build solution - release
run: dotnet build all.sln --configuration release
- name: Test solution - release
run: dotnet test test/test.sln --configuration release
- name: Generate Nuget Packages - release
run: dotnet pack src/prod.sln --configuration release --include-symbols --no-build
- name: upload artifacts
uses: actions/upload-artifact@master
with:
name: ${{ matrix.configuration }}_drop
path: bin/${{ matrix.configuration }}/nugets
name: release_drop
path: ${{ env.NUPKG_OUTDIR }}
- name: Publish binaries to github for tags
if: startswith(github.ref, 'refs/tags/v')
run: |
sudo npm install --silent --no-progress -g github-release-cli
# Parse repository to get owner and repo names
OWNER_NAME="${GITHUB_REPOSITORY%%/*}"
REPO_NAME="${GITHUB_REPOSITORY#*/}"
# Get the list of files
RELEASE_ARTIFACT=(${{ env.NUPKG_OUTDIR }}/*)
export GITHUB_TOKEN=${{ secrets.DAPR_BOT_TOKEN }}
echo "Uploading Nuget packages to GitHub Release"
github-release upload \
--owner $OWNER_NAME \
--repo $REPO_NAME \
--body "Release dapr dotnet SDK v${REL_VERSION}" \
--tag "v${REL_VERSION}" \
--name "Dapr dotnet SDK v${REL_VERSION}" \
--prerelease true \
${RELEASE_ARTIFACT[*]}