📦 Publish #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
lfs: true | |
submodules: 'recursive' | |
- name: 🔎 Read Current Project Verson | |
uses: KageKirin/[email protected] | |
id: current-version | |
with: | |
file: Chickensoft.GoDotTest/Chickensoft.GoDotTest.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.GoDotTest/Chickensoft.GoDotTest.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@v4 | |
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.GoDotTest/Chickensoft.GoDotTest.csproj -c Release | |
# find the built nuget package | |
nuget_package=$(find . -name "Chickensoft.GoDotTest.*.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 |