-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (75 loc) · 2.35 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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-asset-test
- name: Run tests
run: docker-compose run hackney-shared-asset-test
publish-package:
name: Publish Package
runs-on: ubuntu-latest
needs: build-and-test
env:
LBHPACKAGESTOKEN: ${{ secrets.LBHPACKAGESTOKEN }}
VERSION: ${{ needs.build-and-test.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build the Package
run: dotnet pack Hackney.Shared.Asset -p:PackageVersion=$VERSION --configuration Release
- name: Publish the Package
run: |
cd Hackney.Shared.Asset/bin/Release
dotnet nuget push Hackney.Shared.Asset.*.nupkg -s https://nuget.pkg.github.com/LBHackney-IT/index.json --api-key ${{ secrets.NUGET_KEY }}