-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Rune580/build-system-refactor
Refactor Build System
- Loading branch information
Showing
26 changed files
with
453 additions
and
1,148 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"tcli": { | ||
"version": "0.2.3", | ||
"commands": [ | ||
"tcli" | ||
] | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Restore project | ||
run: | | ||
dotnet restore | ||
dotnet tool restore | ||
- name: Build project | ||
run: dotnet build -c Release | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: ./dist/*.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: [ 'v*' ] | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Restore project | ||
run: | | ||
dotnet restore | ||
dotnet tool restore | ||
- name: Build and pack project | ||
run: dotnet pack -c Release | ||
|
||
- name: Upload Thunderstore artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: thunderstore-build | ||
path: ./dist/*.zip | ||
|
||
- name: Upload nupkg artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: nupkg-build | ||
path: ./*/bin/Release/*.nupkg | ||
|
||
upload-release-artifacts: | ||
name: Upload Release Artifacts | ||
needs: build | ||
runs-on: ubuntu-latest | ||
env: | ||
RELEASE_VERSION: ${{ github.ref_name }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: Delete old release if it already exists | ||
run: gh release delete --yes "${RELEASE_VERSION}" | ||
continue-on-error: true | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Release under current tag | ||
run: | | ||
export "CHANGELOG_FILE=$(mktemp --suffix=.md)" | ||
echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV | ||
gh api --method POST -H "Accept: application/vnd.github+json" \ | ||
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \ | ||
-f tag_name="${RELEASE_VERSION}" \ | ||
--jq ".body" > "${CHANGELOG_FILE}" | ||
cat "${CHANGELOG_FILE}" | ||
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" thunderstore-build/*.zip nupkg-build/*/bin/Release/*.nupkg | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
deploy-to-nuget: | ||
name: Deploy to Nuget | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download nupkg artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: nupkg-build | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Publish to NuGet.org | ||
run: | | ||
dotnet nuget push ./*/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_TOKEN }} --source https://api.nuget.org/v3/index.json | ||
deploy-to-thunderstore: | ||
name: Deploy to Thunderstore | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download Thunderstore artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: thunderstore-build | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Restore project tools | ||
run: dotnet tool restore | ||
|
||
- name: Publish to Thunderstore | ||
env: | ||
TCLI_AUTH_TOKEN: ${{ secrets.THUNDERSTORE_TOKEN }} | ||
run: | | ||
dotnet build -target:PublishThunderstoreArtifact |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,4 +358,6 @@ MigrationBackup/ | |
|
||
global.json | ||
|
||
.directory | ||
.directory | ||
|
||
dist/ |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.