-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.92 KB
/
publish-nuget.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
name: Package and Publish (NuGet.org)
on:
push:
branches:
- main
tags-ignore:
- '*' # don't loop
jobs:
tag:
runs-on: ubuntu-latest
outputs:
result: ${{steps.s1.outputs.TAG_RESULT}}
steps:
- name: Determine Tag
id: s1
run: |
version=$(echo "${{github.event.head_commit.message}}" | perl -nle 'm/build:\s*([0-9]+.[0-9]+.[0-9]+-?[a-z0-9]*)/; print $1');
if [ -z "$version" ];
then
echo "No build version found";
echo "TAG_RESULT=fail" >> $GITHUB_OUTPUT;
else
export TAG_VERSION=$version;
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_OUTPUT;
echo "TAG_RESULT=pass" >> $GITHUB_OUTPUT;
fi
- name: Create Tag
if: steps.s1.outputs.TAG_RESULT == 'pass'
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{steps.s1.outputs.TAG_VERSION}}",
sha: context.sha
})
publish:
runs-on: ubuntu-latest
needs: tag
if: ${{needs.tag.outputs.result == 'pass' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Package
run: dotnet pack --configuration Release --no-build
- name: Push package
run: dotnet nuget push "**/Release/XIVCalc*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json