-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GH actions for build and release
- Loading branch information
Safarte
committed
Jan 5, 2024
1 parent
d864456
commit 91e9e14
Showing
3 changed files
with
83 additions
and
0 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,27 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build the solution | ||
run: dotnet build "CommunityResources.sln" -c Release | ||
|
||
- name: Find zip | ||
id: find-zip | ||
run: | | ||
echo "zip=$(ls -1 dist/CommunityResources-*.zip | head -n 1)" >> $GITHUB_ENV | ||
echo "artifact_name=CommunityResourcesRelease" >> $GITHUB_ENV | ||
- name: Upload zip artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.artifact_name }} | ||
path: ${{ env.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,40 @@ | ||
name: Upload release | ||
|
||
on: | ||
release: | ||
types: [ "published" ] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download NuGet | ||
id: download-nuget | ||
run: | | ||
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe | ||
- name: Install jq | ||
uses: dcarbone/[email protected] | ||
|
||
- name: Build the solution | ||
run: | | ||
version=$(jq -r '.version' plugin_template/swinfo.json) | ||
echo "Version is $version" | ||
dotnet build "CommunityResources.sln" -c Release | ||
echo "release_filename=CommunityResources-$version.zip" >> $GITHUB_ENV | ||
echo "zip=$(ls -1 dist/CommunityResources-*.zip | head -n 1)" >> $GITHUB_ENV | ||
echo "upload_url=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].upload_url' | tr -d \")" >> $GITHUB_ENV | ||
- name: Upload zip to release | ||
uses: shogo82148/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ env.upload_url }} | ||
asset_path: ${{ env.zip }} | ||
asset_name: ${{ env.release_filename }} | ||
asset_content_type: application/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,16 @@ | ||
name: Verify swinfo.json | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Verify KSP2 Mod | ||
uses: Rexicon226/[email protected] |