Skip to content

Merge pull request #7 from LBHackney-IT/update-enums #28

Merge pull request #7 from LBHackney-IT/update-enums

Merge pull request #7 from LBHackney-IT/update-enums #28

Workflow file for this run

name: publish-nuget-package
on:
push:
branches:
- main
- feature/**
jobs:
calculate-version:
name: Calculate Version
runs-on: ubuntu-latest
env:
LBHPACKAGESTOKEN: ${{secrets.LBHPACKAGESTOKEN }}
outputs:
version: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine package version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: Display package version
run: |
echo "Version: $GITVERSION_NUGETVERSIONV2"
check-code-formatting:
name: Check code formatting
runs-on: ubuntu-latest
needs: calculate-version
env:
LBHPACKAGESTOKEN: ${{secrets.LBHPACKAGESTOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dotnet format
run: dotnet tool install dotnet-format --tool-path ./dotnet-format-local/
- name: Run formatter check
run: ./dotnet-format-local/dotnet-format --check
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
needs: calculate-version
env:
LBHPACKAGESTOKEN: ${{secrets.LBHPACKAGESTOKEN }}
outputs:
version: ${{ needs.calculate-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: docker-compose build hackney-shared-patches-and-areas-test
- name: Run tests
run: docker-compose run hackney-shared-patches-and-areas-test
publish-package:
name: Publish Package
runs-on: ubuntu-latest
needs: build-and-test
env:
VERSION: ${{ needs.build-and-test.outputs.version }}
LBHPACKAGESTOKEN: ${{secrets.NUGET_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build the Package
run: dotnet pack Hackney.Shared.PatchesAndAreas -p:PackageVersion=$VERSION --configuration Release
- name: Publish the Package
run: |
cd Hackney.Shared.PatchesAndAreas/bin/Release
dotnet nuget push Hackney.Shared.PatchesAndAreas.*.nupkg -s https://nuget.pkg.github.com/LBHackney-IT/index.json --api-key ${{secrets.NUGET_KEY }}