Skip to content

Commit

Permalink
Update build pipeline, add CODEOWNERS and development docs (#114)
Browse files Browse the repository at this point in the history
* Add CODEOWNERS and docs

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* TEMP: changes for testing

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Use GH CLI instead of github-release-cli

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Try to fix this one?

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Add another token

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Update

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Remove the IF

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Ok!

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Edit version

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Another try

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Prepare for release

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Use export syntax

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Skip signing

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Use GitHub token

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Reorder steps

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

* Add release notes

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>

---------

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>
  • Loading branch information
shubham1172 authored May 18, 2023
1 parent b2d6a57 commit 9863459
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 40 deletions.
76 changes: 38 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,6 @@ jobs:
run: dotnet build --configuration ${{ env.CONFIGURATION }} --configfile nuget.config
- name: Run Unit Tests - ${{ env.CONFIGURATION }}
run: dotnet test --configuration ${{ env.CONFIGURATION }} --no-build --verbosity normal
- name: Generate NuGet Packages - ${{ env.CONFIGURATION }}
if: startswith(github.ref, 'refs/tags/v')
run: dotnet pack --configuration ${{ env.CONFIGURATION }} -p:PackageVersion=${REL_VERSION}
# Since we create local development nuget packages, we need to clean them up.
- name: Clean up development Nuget packages
if: startswith(github.ref, 'refs/tags/v')
run: rm -rf ${{ env.NUPKG_OUTDIR }}/*${{ env.DEV_VERSION_SUFFIX }}*.nupkg
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
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.GITHUB_TOKEN }}
echo "Uploading Nuget packages to GitHub Release"
github-release upload \
--owner $OWNER_NAME \
--repo $REPO_NAME \
--body "Release dapr azure functions extension v${REL_VERSION}" \
--tag "v${REL_VERSION}" \
--name "Dapr Azure Functions Extension v${REL_VERSION}" \
${RELEASE_ARTIFACT[*]}
- name: Publish nuget packages to nuget.org for tags
if: startswith(github.ref, 'refs/tags/v') && !(endsWith(github.ref, '-rc') || endsWith(github.ref, '-dev') || endsWith(github.ref, '-prerelease'))
run: |
dotnet nuget push "${{ env.NUPKG_OUTDIR }}/*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGETORG_DAPR_API_KEY }} --source https://api.nuget.org/v3/index.json
# The docker image is not pushed for pull requests,
# but the image is built to ensure that the Dockerfile and the sample app are valid.
- name: Set a sample app registry when it is a pull request
Expand All @@ -91,8 +54,45 @@ jobs:
- name: Push samples docker images
if: github.event_name != 'pull_request'
run: |
echo performing docker login
echo performing docker login
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
echo pushing docker image for ${{ env.DOTNET_SAMPLE_APP_IMAGE_NAME }}
echo image with tag ${{ env.APP_REGISTRY }}/${{ env.DOTNET_SAMPLE_APP_IMAGE_NAME }}:${{ env.REL_VERSION }} will be pushed
docker push ${{ env.APP_REGISTRY }}/${{ env.DOTNET_SAMPLE_APP_IMAGE_NAME }}:${{ env.REL_VERSION }}
- name: Generate NuGet Packages - ${{ env.CONFIGURATION }}
if: startswith(github.ref, 'refs/tags/v')
run: dotnet pack --configuration ${{ env.CONFIGURATION }} -p:PackageVersion=${REL_VERSION}
# Since we create local development nuget packages, we need to clean them up.
- name: Clean up development Nuget packages
if: startswith(github.ref, 'refs/tags/v')
run: rm -rf $NUPKG_OUTDIR/*${DEV_VERSION_SUFFIX}.*{nupkg,snupkg}
- name: Upload artifacts
uses: actions/upload-artifact@master
if: startswith(github.ref, 'refs/tags/v')
with:
name: release_drop
path: ${{ env.NUPKG_OUTDIR }}
- name: Create a GitHub Release
if: startswith(github.ref, 'refs/tags/v')
run: |
RELEASE_ARTIFACT=(${NUPKG_OUTDIR}/*)
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
echo "Uploading Nuget packages to GitHub Release"
gh release create "v${REL_VERSION}" ${RELEASE_ARTIFACT[*]} \
--repo "${GITHUB_REPOSITORY}" \
--title "Azure Functions Dapr Extension v${REL_VERSION}" \
--notes "Release Azure Functions Dapr Extension v${REL_VERSION}"
- name: Upload NuGet packages to Azure blob storage
if: |
startsWith(github.ref, 'refs/tags/v') &&
!(endsWith(github.ref, '-rc') || endsWith(github.ref, '-dev') || endsWith(github.ref, '-prerelease')) &&
github.repository == 'Azure/azure-functions-dapr-extension'
run: |
# Install azcopy
wget -O azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xf azcopy_v10.tar.gz --strip-components=1
# Upload nuget packages to Azure blob storage
export AZCOPY_SPA_CLIENT_SECRET=${{ secrets.AZCOPY_SPA_CLIENT_SECRET }}
./azcopy login --service-principal --application-id ${{ secrets.AZCOPY_SPA_APPLICATION_ID }}
./azcopy copy "${{ env.NUPKG_OUTDIR }}/*" "https://azuresdkpartnerdrops.blob.core.windows.net/drops/azure-functions-dapr-extension/dotnet/${{ env.REL_VERSION }}/"
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These owners are the maintainers of this repo
* @Azure/maintainers-azure-functions-dapr-extension
5 changes: 5 additions & 0 deletions docs/development/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Development

* [Development](./development.md) - How to setup local development environment and build/test Azure Functions Dapr Extension.
* [Release Process](./release-process.md) - How to release Azure Functions Dapr Extension.
* [Setup Continuous Integration](./setup-ci.md) - How to setup GitHub Actions for Azure Functions Dapr Extension.
13 changes: 13 additions & 0 deletions docs/development/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Setup Local Development

This document is a TODO.

## Prerequisites

## Clone the repository

## Build the project

## Run tests

## Debugging
19 changes: 19 additions & 0 deletions docs/development/release-process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Release Process

This document describes the release process for Azure Functions Dapr Extension.

## Trigger a release

1. Create a new branch from `master` branch in the format of `release-<major>.<minor>` (e.g. `release-0.14`).
2. Add a tag and push it.
```bash
$ git tag "v0.14.0-preview01" -m "v0.14.0-preview01"
$ git push --tags
```
3. CI will create a new release in GitHub, push the NuGet packages to Azure blob storage, and upload the sample image to Docker registry.
4. [MICROSOFT PROCESS] Upload the NuGet packages to NuGet.org using the Azure DevOps pipeline.
5. Edit the release notes if necessary.
6. Test and validate the functionalities with the specific version
7. If there are regressions and bugs, fix them in `release-*` branch and merge back to master
8. Create new tags (with suffix -preview02, -preview03, etc.) and push them to trigger CI to create new releases
9. Repeat from 6 to 8 until all bugs are fixed
32 changes: 32 additions & 0 deletions docs/development/setup-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Setup Continuous Integration

This repository uses GitHub Actions to automate the build and release. As long as you have a GitHub Account, you can set up your own private Actions in your own fork. This document helps you set up the continuous integration for Azure Functions Dapr Extension.

## Prerequisites

A GitHub account.

## Setup

1. Fork [Azure/azure-functions-dapr-extension](https://github.com/Azure/azure-functions-dapr-extension) to your GitHub account.
2. Go to `Settings`-> `Secrets and variables` -> `Actions`.
3. Add the required repository secrets.

### Required repository secrets

| Name | Description |
|--|--|
| DOCKER_REGISTRY_ID | Username for Docker registry, required for uploading sample image|
| DOCKER_REGISTRY_PASS | Password for Docker registry, required for uploading sample image|
| DOCKER_REGISTRY | URL to Docker registry, required for uploading sample image |
| AZCOPY_SPA_APPLICATION_ID | Service principal application ID for AzCopy, required for uploading NuGet packages |
| AZCOPY_SPA_CLIENT_SECRET | Service principal client secret for AzCopy, required for uploading NuGet packages |
| GITHUB_TOKEN | GitHub token, required for creating release |

Notes
- `GITHUB_TOKEN` is automatically set by GitHub Actions, so you don't need to set it manually.
- `AZCOPY_*` secrets should not be set for forks, as they are only required for uploading NuGet packages for official release. The step that requires these secrets will be skipped for forks.

4. Go to `Settings` -> `Actions` -> `General` and make sure to allow running GitHub Actions.


5 changes: 3 additions & 2 deletions properties/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
</PropertyGroup>

<!-- Signing -->
<PropertyGroup>
<!-- Skip signing here and rely on the Azure SDK CI to sign the assembly -->
<!-- <PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
</PropertyGroup> -->

<!-- Enable sourcelink https://docs.microsoft.com/dotnet/standard/library-guidance/sourcelink -->
<PropertyGroup>
Expand Down

0 comments on commit 9863459

Please sign in to comment.