Skip to content

Commit

Permalink
housekeeping: make a release job (#421)
Browse files Browse the repository at this point in the history
* housekeeping: make a release job

* Further refinements
  • Loading branch information
glennawatson authored Oct 6, 2020
1 parent 27571b2 commit 5730dae
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 55 deletions.
61 changes: 35 additions & 26 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
name: .NET Core Desktop
name: Build

on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [ main ]

env:
configuration: Release
productNamespacePrefix: "DynamicData"
validRelease: ${{ contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
source-url: https://api.nuget.org/v3/index.json

jobs:
build:

runs-on: windows-latest

outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:

- name: PR Environment
run: |
echo Release Tag Contained - ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
echo Pull Request - ${{ github.event_name == 'pull_request' }}
echo GitHub Action - ${{ github.event.action == 'closed' }}
echo Pull Request Merged - ${{ github.event.pull_request.merged == true }}
- name: Checkout
uses: actions/checkout@v2
with:
Expand All @@ -39,6 +27,7 @@ jobs:
dotnet-version: 3.1.x

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
Expand All @@ -65,28 +54,48 @@ jobs:
run: reportgenerator -reports:"coverage.*.xml" -targetdir:report-output
working-directory: artifacts/coverage

- name: Generate Coverage Artifacts
uses: actions/upload-artifact@master
with:
name: Coverage
path: artifacts/coverage/report-output

- name: Upload Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
directory: artifacts/coverage

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'

release:
runs-on: ubuntu-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Download NuGet Packages
uses: actions/download-artifact@v2
with:
name: nuget

- name: NuGet Push
if: env.validRelease == 'true'
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg
- name: Create Tag
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: changelog
env:
REPO: ${{ github.repository }}

- name: Create Release
uses: actions/create-release@v1
if: env.validRelease == 'true'
run: |
git tag v${{ steps.nbgv.outputs.SemVer2 }} main
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.changelog }}
29 changes: 0 additions & 29 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 5730dae

Please sign in to comment.