Skip to content

Added missing .net 9 setup in pack and publish (#6) #133

Added missing .net 9 setup in pack and publish (#6)

Added missing .net 9 setup in pack and publish (#6) #133

name: publish
on:
push:
branches: ["main"]
tags: ["v*.*.*"] # Publish semver tags as releases.
pull_request:
branches: ["main"]
jobs:
build-and-test:
environment: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore src/Hooki
- name: Build
run: dotnet build src/Hooki --configuration Release --no-restore
- name: Run Unit Tests
run: dotnet test src/Hooki.UnitTests/Hooki.UnitTests.csproj --no-restore
- name: Run Integration Tests
env:
DOTNET_ENVIRONMENT: ${{ vars.DOTNET_ENVIRONMENT }}
TEST_DISCORD_WEBHOOK_URL: ${{ secrets.TEST_DISCORD_WEBHOOK_URL }}
TEST_MICROSOFT_TEAMS_WEBHOOK_URL: ${{ secrets.TEST_MICROSOFT_TEAMS_WEBHOOK_URL }}
TEST_SLACK_WEBHOOK_URL: ${{ secrets.TEST_SLACK_WEBHOOK_URL }}
TEST_PIPEDREAM_URL: ${{ secrets.TEST_PIPEDREAM_URL }}
TEST_IMAGE_FILE_NAME: ${{ vars.TEST_IMAGE_FILE_NAME }}
TEST_IMAGE_CLOUD_URL: ${{ secrets.TEST_IMAGE_CLOUD_URL }}
run: dotnet test src/Hooki.IntegrationTests/Hooki.IntegrationTests.csproj --no-restore
pack-and-publish:
needs: build-and-test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore src/Hooki
- name: Build
run: dotnet build src/Hooki --configuration Release --no-restore
- name: Set version and trim leading 'v'
run: |
version=$(echo ${{ github.ref_name }} | sed 's/^v//')
echo "VERSION=$version" >> $GITHUB_ENV
echo "Set VERSION to $version"
- name: Pack
run: dotnet pack src/Hooki/Hooki.csproj --configuration Release --no-build -p:PackageVersion=${{env.VERSION}} --output ./nupkgs
- name: Publish to NuGet
run: dotnet nuget push "./nupkgs/Hooki.*" --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate