This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (82 loc) · 2.84 KB
/
publish.yaml
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
name: '📦 Publish'
on:
workflow_dispatch:
branches:
- main
inputs:
bump:
description: "Version Bump Method"
type: choice
options:
- major
- minor
- patch
required: true
workflow_call:
secrets:
NUGET_API_KEY:
description: "NuGet API Key"
required: true
inputs:
bump:
description: "Version Bump Method"
type: string
required: true
jobs:
publish:
name: 📦 Publish
runs-on: ubuntu-latest
steps:
- name: 🧾 Checkout
uses: actions/checkout@v3
with:
lfs: true
submodules: 'recursive'
- name: 🔎 Read Current Project Verson
uses: KageKirin/[email protected]
id: current-version
with:
file: Chickensoft.GoDotNet/Chickensoft.GoDotNet.csproj
xpath: /Project/PropertyGroup/Version
- name: 🖨 Print Current Version
run: |
echo "Current Version: ${{ steps.current-version.outputs.version }}"
- name: 🧮 Compute Next Version
uses: chickensoft-games/next-godot-csproj-version@v1
id: next-version
with:
project-version: ${{ steps.current-version.outputs.version }}
godot-version: global.json
bump: ${{ inputs.bump }}
- name: ✨ Print Next Version
run: |
echo "Next Version: ${{ steps.next-version.outputs.version }}"
- name: 📝 Change Version
uses: vers-one/[email protected]
with:
file: "Chickensoft.GoDotNet/Chickensoft.GoDotNet.csproj"
version: ${{ steps.next-version.outputs.version }}
- name: ✍️ Commit Changes
run: |
git config user.name "[email protected]"
git config user.email "GitHub Action"
git commit -a -m "chore(version): update version to ${{ steps.next-version.outputs.version }}"
git push
- name: ✨ Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --generate-notes "v${{ steps.next-version.outputs.version }}"
- name: 💽 Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: 📦 Publish
run: |
# build the package
dotnet build Chickensoft.GoDotNet/Chickensoft.GoDotNet.csproj -c Release
# find the built nuget package
nuget_package=$(find . -name "Chickensoft.GoDotNet.*.nupkg")
echo "📦 Publishing package: $nuget_package"
# publish the nuget package
dotnet nuget push "$nuget_package" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate