Skip to content

Commit

Permalink
ci: publish on github
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeFwd committed Oct 20, 2024
1 parent bc40e7f commit e1cd6b0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 20 deletions.
72 changes: 52 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,66 @@
name: Publish on NuGet/GPR
name: Publish

on:
push:
branches:
- main

jobs:
run-tests:
uses: JoeFwd/Bannerlord.ExpandedTemplate/.github/workflows/test.yml@main
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

publish-on-github:

name: Publish Module on NuGet/GPR
build-module:
runs-on: ubuntu-latest
needs: ["run-tests"]
steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Build
run: |
artifact=$(pwd)/bannerlord
mkdir -p $artifact;
proj="Bannerlord.ExpandedTemplate.Integration/Bannerlord.ExpandedTemplate.Integration.csproj";
dotnet clean $proj --configuration Release;
dotnet build $proj --configuration Release -p:GameFolder="$artifact";
- name: Pack
run: dotnet pack --configuration Release -o "./packages"
- name: Install Bannerlord.ChangelogParser
run: dotnet tool install -g Bannerlord.ChangelogParser;
shell: pwsh

- name: Push to NuGet
run: dotnet nuget push "./packages/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://www.nuget.org --skip-duplicate
shell: pwsh

- name: Run ChangelogParser
id: changelog
run: |
vers="$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")"
echo "::set-output name=mod_version::$vers"
desc="$(bannerlord_changelog_parser fulldescription -f "$PWD/changelog.txt")"
desc="${desc//'%'/'%25'}"
desc="${desc//$'\n'/'%0A'}"
desc="${desc//$'\r'/'%0D'}"
echo "::set-output name=mod_description::$desc"
- name: Upload bannerlord folder
uses: actions/upload-artifact@v4
with:
name: bannerlord
path: ./bannerlord

###########################
# NUGET/GPR #
###########################
# publish-on-nuget:
# needs: [ "build-module" ]
# uses: BUTR/workflows/.github/workflows/release-nuget.yml@master
# with:
# project_path: Bannerlord.ExpandedTemplate.API/Bannerlord.ExpandedTemplate.API.csproj
# secrets:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

###########################
# GITHUB #
###########################
publish-on-github:
needs: [ "build-module" ]
uses: BUTR/workflows/.github/workflows/release-github.yml@master
with:
mod_id: Bannerlord.ExpandedTemplate
mod_version: ${{ needs.build-module.outputs.mod_version }}
mod_description: ${{ needs.build-module.outputs.mod_description }}
artifact_name: bannerlord
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Game Versions: v1.2.11
* feat: pick random equipment from equipment pool for heroes and battle type
* feat: add submodule for testing purposes
* doc: add changelog
* ci: publish on github
---------------------------------------------------------------------------------------------------
Version: 1.0.0
Game Versions: v1.2.11
Expand Down

0 comments on commit e1cd6b0

Please sign in to comment.