Skip to content

Commit

Permalink
fix build?
Browse files Browse the repository at this point in the history
  • Loading branch information
eoinobrien committed Jun 29, 2024
1 parent a05839f commit 8614683
Showing 1 changed file with 25 additions and 70 deletions.
95 changes: 25 additions & 70 deletions .github/workflows/build_test_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,54 @@ on:
types: [ created ]

env:
DOTNET_VERSION: 5.0.100
DOTNET_3_VERSION: 3.1.301
DOTNET_VERSION: '8.0.x'
AZURE_FUNCTIONAPP_NAME: 'LuasAPIFunction'
AZURE_FUNCTIONAPP_PACKAGE_PATH: './LuasAPI.AzureFunction'

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_3_VERSION }}
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal

pack:
build-and-deploy:
runs-on: ubuntu-latest
needs: build-and-test
if: github.event_name == 'release'
environment: dev
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup .NET Core 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_3_VERSION }}
- name: Dotnet Pack Nuget
run: dotnet pack --output ./nuget-artifact --configuration Release -p:Version=${{ github.event.release.tag_name }}
- uses: actions/upload-artifact@v1
with:
name: nuget-artifact
path: ./nuget-artifact
- name: Dotnet Publish Function
run: dotnet publish ./LuasAPI.AzureFunction/LuasAPI.AzureFunction.csproj --configuration Release --output ./function-artifact
- uses: actions/upload-artifact@v1
with:
name: function-artifact
path: ./function-artifact
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

publish-to-nuget:
runs-on: ubuntu-latest
needs: pack
if: github.event_name == 'release' && !github.event.release.draft
steps:
- name: Setup .NET Core 5.0
uses: actions/setup-dotnet@v1
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/download-artifact@v1
with:
name: nuget-artifact
path: ./nuget-artifact
- name: Upload Asset to Release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: nuget-artifact/LuasAPI.NET.${{ github.event.release.tag_name }}.nupkg
asset_name: nuget-artifact/LuasAPI.NET.${{ github.event.release.tag_name }}.nupkg
asset_content_type: application/zip
- name: Publish packages
run: dotnet nuget push ./nuget-artifact/**.nupkg --source nuget.org --api-key ${{secrets.NUGET_API_KEY}}

deploy-azure-function:
runs-on: ubuntu-latest
needs: pack
if: github.event_name == 'release' && !github.event.release.prerelease && !github.event.release.draft
steps:
- uses: actions/download-artifact@v1
with:
name: function-artifact
path: ./function-artifact
- name: 'Deploy LuasAPI.AzureFunction Action'
- name: 'Resolve Project Dependencies Using Dotnet'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: './function-artifact'
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}

0 comments on commit 8614683

Please sign in to comment.