Merge branch 'dotnet8' #119
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: Main Workflow | |
on: | |
push: | |
pull_request: | |
jobs: | |
all: | |
name: Build, Test, Deploy, Tag | |
runs-on: ubuntu-latest | |
steps: | |
- uses: rlespinasse/[email protected] | |
- name: Set up dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Build | |
run: dotnet build -c Release TwoMQTT | |
- name: Test | |
run: dotnet test --collect:"XPlat Code Coverage" TwoMQTTTest | |
- name: Upload coverage | |
run: bash <(curl -s https://codecov.io/bash) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
- name: Package (Non-Main) | |
run: dotnet pack -c Debug -o output --version-suffix="${{ env.GITHUB_REF_SLUG }}" TwoMQTT | |
if: github.event_name == 'push' && github.ref != 'refs/heads/main' | |
- name: Package (Main) | |
run: dotnet pack -c Release -o output TwoMQTT | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
- name: Setup outputs for later | |
id: var | |
run: | | |
PACKAGE_FILE=$(ls output/*.nupkg) | |
BUILD_VERSION=${PACKAGE_FILE/output\/TwoMQTT./} | |
BUILD_VERSION=${BUILD_VERSION/.nupkg/} | |
echo "package=$PACKAGE_FILE" >> $GITHUB_OUTPUT | |
echo "version=$BUILD_VERSION" >> $GITHUB_OUTPUT | |
if: github.event_name == 'push' | |
- name: Upload package | |
run: dotnet nuget push ${{ steps.var.outputs.package }} -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json | |
if: github.event_name == 'push' | |
- name: Unlist package | |
env: | |
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
run: | | |
dotnet nuget delete TwoMQTT ${{ steps.var.outputs.version }} --non-interactive -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json | |
if: github.event_name == 'push' | |
- name: Tag and push the git release | |
run: | | |
git tag -f ${{ steps.var.outputs.version }} | |
git push --tags | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |