-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (83 loc) · 2.58 KB
/
cd_release_please.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
87
88
89
90
91
92
93
94
95
96
name: "Release Please"
on:
workflow_dispatch:
push:
# Run on main branch changes and let release-please create
# PRs for version bumps and new releases
branches:
- main
paths:
- "**/*.cs"
- "**/*.cs*"
- ".release-please-manifest.json"
- "release-please-config.json"
pull_request:
# Only run during a PR if the release-please manifest has changed,
# meaning that versions are attempting to be updated.
types: [opened, synchronize, reopened]
jobs:
release-please:
name: Release Please
# Only run on main, after merge is completed
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "16"
- name: Run release-please
uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
bump-versions:
name: Set Version
# Only run on pull requests
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if manifest has changed
id: check_changes
run: |
if git diff --name-only HEAD^ HEAD | grep -q '.release-please-manifest.json'; then
echo "File changed"
echo "file_changed=true" >> $GITHUB_OUTPUT
else
echo "File not changed"
echo "file_changed=false" >> $GITHUB_OUTPUT
fi
- name: Bump versions
uses: lekman/release-please-dotnet@v1
if: steps.check_changes.outputs.file_changed == 'true'
with:
manifest: ".release-please-manifest.json"
branch: ${{ github.head_ref }}
publish:
name: Publish
# Only run on main, after merge is completed
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build
- name: Publish
run: dotnet publish -c Release
- name: Publish to Nuget
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate