mirror of https://github.com/dapr/dotnet-sdk.git
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:
parent
b02aa3f02b
commit
ea0c4436f7
|
|
@ -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))
|
||||||
|
|
@ -16,24 +16,47 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Projects
|
name: Build Projects
|
||||||
runs-on: windows-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
env:
|
||||||
matrix:
|
NUPKG_OUTDIR: bin/Release/nugets
|
||||||
configuration: [release, debug]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
- name: Parse release version
|
||||||
|
run: python ./.github/scripts/get_release_version.py
|
||||||
- name: Setup .NET Core
|
- name: Setup .NET Core
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: 3.1.100
|
dotnet-version: 3.1.100
|
||||||
- name: Build solution - ${{ matrix.configuration }}
|
- name: Build solution - release
|
||||||
run: dotnet build all.sln --configuration ${{ matrix.configuration }}
|
run: dotnet build all.sln --configuration release
|
||||||
- name: Test solution - ${{ matrix.configuration }}
|
- name: Test solution - release
|
||||||
run: dotnet test test/test.sln --configuration ${{ matrix.configuration }}
|
run: dotnet test test/test.sln --configuration release
|
||||||
- name: Generate Nuget Packages - ${{ matrix.configuration }}
|
- name: Generate Nuget Packages - release
|
||||||
run: dotnet pack src/prod.sln --configuration ${{ matrix.configuration }} --include-symbols --no-build
|
run: dotnet pack src/prod.sln --configuration release --include-symbols --no-build
|
||||||
- name: upload artifacts
|
- name: upload artifacts
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.configuration }}_drop
|
name: release_drop
|
||||||
path: bin/${{ matrix.configuration }}/nugets
|
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[*]}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue