Skip to content

Commit

Permalink
feat: add workflow to make releases from github
Browse files Browse the repository at this point in the history
  • Loading branch information
jolexxa committed Oct 14, 2023
1 parent d8a14bc commit 3ff73e5
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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 Version
uses: KageKirin/[email protected]
id: current-version
with:
file: GodotEnv/Chickensoft.GodotEnv.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 }}
# This action was designed to pin versions to Godot versions, but
# if you pass a stable version in it just bumps the project version
# that you give it.
godot-version: 1.0.0
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: "GodotEnv/Chickensoft.GodotEnv.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 GodotEnv/Chickensoft.GodotEnv.csproj -c Release
# find the built nuget package
nuget_package=$(find . -name "Chickensoft.GodotEnv.*.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

0 comments on commit 3ff73e5

Please sign in to comment.