Skip to content

Bump minver-cli from 4.2.0 to 4.3.0 in /src (#58) #130

Bump minver-cli from 4.2.0 to 4.3.0 in /src (#58)

Bump minver-cli from 4.2.0 to 4.3.0 in /src (#58) #130

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build Process
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
env:
CODE_LOCATION: /home/runner/work/tf-whatsup/tf-whatsup/src/
RELEASE_LOCATION: /home/runner/work/tf-whatsup/tf-whatsup/src/TFWhatsUp.Console/bin/Release/net7.0/
PUBLISH_COMMAND_FLAGS: "-c Release -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --sc false"
PUBLISH_COMMAND_FLAGS_SC: "-c Release -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --sc true"
jobs:
build:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.set-version.outputs.VERSION }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- name: Restore dependencies
run: dotnet restore
working-directory: "${{env.CODE_LOCATION}}"
- name: Restore tools
run: dotnet tool restore
working-directory: "${{env.CODE_LOCATION}}"
- name: Set Version Number
id: set-version
working-directory: "${{env.CODE_LOCATION}}"
run: |
VERSION=$(dotnet minver -t v -v e)
echo "$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build
working-directory: "${{env.CODE_LOCATION}}"
run: dotnet build -c Release --no-restore
- name: Test
working-directory: "${{env.CODE_LOCATION}}"
run: dotnet test -c Release --no-build --verbosity normal
- name: Pack
working-directory: "${{env.CODE_LOCATION}}/TFWhatsUp.Console"
run: dotnet pack -c Release --no-build --verbosity normal
- name: "Save Artifact: NuGet Package"
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: nuget-package
path: "${{env.CODE_LOCATION}}/TFWhatsUp.Console/nupkg/*.nupkg"
publish_artifacts:
runs-on: ubuntu-latest
strategy:
matrix:
RID: ["osx-x64", "linux-x64", "win-x64"]
fail-fast: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- name: Publish Single-File .EXE - ${{matrix.RID}}
working-directory: "${{env.CODE_LOCATION}}"
run: dotnet publish -r ${{matrix.RID}} ${{env.PUBLISH_COMMAND_FLAGS}}
- name: ZIP Single-File .EXE - ${{matrix.RID}}
working-directory: "${{env.CODE_LOCATION}}"
run: |
mkdir ${{env.CODE_LOCATION}}output
tar cvz -C ${{env.RELEASE_LOCATION}}${{matrix.RID}}/publish -f ${{env.CODE_LOCATION}}output/tfwhatsup_${{matrix.RID}}.tar.gz .
- name: "Save Artifact: ${{matrix.RID}}"
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: tfwhatsup_${{matrix.RID}}
path: "${{env.CODE_LOCATION}}output/tfwhatsup_${{matrix.RID}}.tar.gz"
- name: Clear the publish directories
run: rm -rf ${{env.RELEASE_LOCATION}}${{matrix.RID}}/publish
- name: Publish Self-Contained .EXEs - ${{matrix.RID}}_selfcontained
working-directory: "${{env.CODE_LOCATION}}"
run: dotnet publish -r ${{matrix.RID}} ${{env.PUBLISH_COMMAND_FLAGS_SC}}
- name: ZIP Single-File .EXE - ${{matrix.RID}}_selfcontained
working-directory: "${{env.CODE_LOCATION}}"
run: |
tar cvz -C ${{env.RELEASE_LOCATION}}${{matrix.RID}}/publish -f ${{env.CODE_LOCATION}}output/tfwhatsup_${{matrix.RID}}_sefcontained.tar.gz .
- name: "Save Artifact: ${{matrix.RID}}_selfcontained"
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: tfwhatsup_${{matrix.RID}}_selfcontained
path: "${{env.CODE_LOCATION}}output/tfwhatsup_${{matrix.RID}}_sefcontained.tar.gz"
create_release:
needs: [build, publish_artifacts]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
nuget-version: "5.x"
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: See download contents
run: ls -R
- name: Create GitHub Release With Assets
uses: ncipollo/release-action@v1
with:
artifacts: "**/*.tar.gz,**/*.nupkg"
tag: "v${{needs.build.outputs.VERSION}}"
artifactErrorsFailBuild: true
allowUpdates: false
draft: false
generateReleaseNotes: true
prerelease: false
- name: Publish Nuget
working-directory: ""
run: nuget push **/*.nupkg -Source 'https://api.nuget.org/v3/index.json'