-
Notifications
You must be signed in to change notification settings - Fork 37
62 lines (51 loc) · 2.02 KB
/
create-release.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: Create release
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
PROJECT_PATH: 'src/GShark/GShark.csproj'
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json'
on:
pull_request:
types: [closed]
branches:
- master
jobs:
build:
if: github.event.action == 'closed' && github.event.pull_request.merged == true
permissions:
contents: write
pull-requests: read
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 👶 Draft release
id: release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 🚧 Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: 📖 Read release
run: echo ${{ steps.release.outputs.tag_name }}
- name: 🔧 Restore nuget with dotnet
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: 🧱 Build project
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release -p:Version=${{ steps.release.outputs.tag_name }}
- name: 📦 Create the package
run: dotnet pack ${{ env.PROJECT_PATH }} --no-restore --no-build --configuration Release -p:PackageVersion=${{ steps.release.outputs.tag_name }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: 🚀 Publish the package
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg --skip-duplicate -k ${{ secrets.NUGET_API_KEY }} -s ${{ env.NUGET_SOURCE_URL }}
- name: 📰 Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.release.outputs.id }}