Repository navigation
109 lines (95 loc) · 3.13 KB
/
Copy pathrelease-plugin-api.yml
File metadata and controls
109 lines (95 loc) · 3.13 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Release Plugin API
on:
push:
tags:
- 'plugin-api@*'
workflow_dispatch:
inputs:
tag:
description: "Tag (e.g. plugin-api@1.2.3 or v1.2.3)"
required: false
jobs:
build-and-publish:
name: Build and Publish to NuGet
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Extract version from tag
id: meta
shell: bash
run: |
INPUT_TAG="${{ github.event.inputs.tag }}"
if [ -n "$INPUT_TAG" ]; then
REF_NAME="$INPUT_TAG"
else
REF_NAME="$GITHUB_REF_NAME"
fi
if [[ "$REF_NAME" == *"@"* ]]; then
VERSION="${REF_NAME#*@}"
else
VERSION="${REF_NAME#v}"
fi
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Restore dependencies
run: dotnet restore DxWorks.ScriptBee.Plugin.Api/DxWorks.ScriptBee.Plugin.Api.csproj
- name: Build
run: >
dotnet build DxWorks.ScriptBee.Plugin.Api/DxWorks.ScriptBee.Plugin.Api.csproj
--no-restore
-c Release
-p:Version=${{ steps.meta.outputs.version }}
- name: Pack
run: >
dotnet pack DxWorks.ScriptBee.Plugin.Api/DxWorks.ScriptBee.Plugin.Api.csproj
--no-build
-c Release
-p:Version=${{ steps.meta.outputs.version }}
-o ./nuget-output
- name: Push to NuGet
run: >
dotnet nuget push ./nuget-output/*.nupkg
--api-key ${{ secrets.NUGET_API_KEY }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate
create-release:
name: Create GitHub Release
needs: build-and-publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract version from tag
id: meta
shell: bash
run: |
INPUT_TAG="${{ github.event.inputs.tag }}"
if [ -n "$INPUT_TAG" ]; then
REF_NAME="$INPUT_TAG"
else
REF_NAME="$GITHUB_REF_NAME"
fi
if [[ "$REF_NAME" == *"@"* ]]; then
VERSION="${REF_NAME#*@}"
else
VERSION="${REF_NAME#v}"
fi
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Extract changelog for current version
id: changelog
run: |
chmod +x ./scripts/extract_changelog.sh
./scripts/extract_changelog.sh "${{ steps.meta.outputs.version }}" DxWorks.ScriptBee.Plugin.Api/CHANGELOG.md
- name: Create Release
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
body_path: RELEASE_NOTES.md