-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.61 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
80
81
82
83
84
85
86
name: Publish
permissions:
contents: write
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
description: Version (Semver without leading v)
nuget-release:
type: boolean
description: Release NuGet Package?
default: true
github-release:
type: boolean
description: Make GitHub Release?
default: true
github-release-draft:
type: boolean
description: Mark GitHub Release as Draft?
default: false
github-release-prerelease:
type: boolean
description: Mark GitHub Release as Prerelease?
default: false
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Set Version from manual input
run: |
echo "Using RELEASE_VERSION = ${{ github.event.inputs.version }}"
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Set Package Name
run: |
echo "PKG_NAME=./Patreon.Api/bin/Release/Patreon.Api.${{ env.RELEASE_VERSION }}.nupkg" >> $GITHUB_ENV
echo "Using PKG_NAME = ${{ env.PKG_NAME }}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
7.0.400
8.0.x
- name: Build
run: dotnet build -c Release -p:Version=$RELEASE_VERSION
- name: Test
run: dotnet test -c Release --no-build
# - name: Add NuGet Source
# run: |
# dotnet nuget add source https://nuget.pkg.github.com/(GITHUB_USERNAME)/index.json
# --name github --username (GITHUB_USERNAME) --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
- name: Push Packages to NuGet
run: |
echo "Pushing ${{ env.PKG_NAME }}"
dotnet nuget push ${{ env.PKG_NAME }} --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
- name: Create Github Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ env.PKG_NAME }}
fail_on_unmatched_files: true
tag_name: v${{ github.event.inputs.version }}
body: '# v${{ github.event.inputs.version }}'
draft: ${{ github.event.inputs.github-release-draft == 'true' }}
prerelease: ${{ github.event.inputs.github-release-prerelease == 'true' }}