2.0 Feature Release (#10) #16
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: Build, Pack & Publish | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.* | |
source-url: https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Build | |
run: dotnet build src/DtronixPackage -c Release | |
- name: Unit tests | |
run: dotnet test src/DtronixPackage.Tests -c Release | |
- name: Pack | |
run: dotnet pack src/DtronixPackage -c Release -o ./artifacts | |
- name: Export artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: artifacts/* | |
- name: Get tag name | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: olegtarasov/get-tag@v2.1 | |
id: tagName | |
- name: Create changelog | |
if: startsWith(github.ref, 'refs/tags/') | |
run: git log --pretty=format:"- %h %B" "$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=2) | Select -Last 1)..$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=2) | Select -First 1)" >> ${{ github.workspace }}/CHANGELOG.TXT | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: "DtronixPackage ${{ steps.tagName.outputs.tag }} Released" | |
files: | | |
artifacts/*.nupkg | |
artifacts/*.snupkg | |
body_path: ${{github.workspace}}/CHANGELOG.TXT | |
- name: Push Nuget packages | |
if: startsWith(github.ref, 'refs/tags/') | |
run: dotnet nuget push artifacts/**/*.nupkg --api-key ${{ secrets.ORG_NUGET_AUTH_TOKEN }} --skip-duplicate |