Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 5 additions & 65 deletions .github/workflows/dotnet-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,13 @@ jobs:
with:
script: |
const fs = require('fs');
var jsonData = JSON.parse(`${{steps.run.outputs.LASTLINE}}`);
core.setOutput("PublishNUPKG", jsonData.PublishNUPKG && fs.existsSync(jsonData.OutputDirectory + "/NUPKG"));
core.setOutput("PublishTSPKG", jsonData.PublishTSPKG && fs.existsSync(jsonData.OutputDirectory + "/TSPKG"));
core.setOutput("PublishNMPKG", jsonData.PublishNMPKG && fs.existsSync(jsonData.OutputDirectory + "/NMPKG"));
core.setOutput("PKGSDIR", jsonData.OutputDirectory);
core.setOutput("OutputDir", `${{steps.run.outputs.LASTLINE}}`);

- uses: actions/upload-artifact@v4
if: ${{steps.attain-fileinfo.outputs.PublishNUPKG == 'true'}}
if: ${{steps.attain-fileinfo.outputs.OutputDir != ''}}
with:
name: NUPKG
path: ${{steps.attain-fileinfo.outputs.PKGSDIR}}/NUPKG
- uses: actions/upload-artifact@v4
if: ${{steps.attain-fileinfo.outputs.PublishTSPKG == 'true'}}
with:
name: TSPKG
path: ${{steps.attain-fileinfo.outputs.PKGSDIR}}/TSPKG
- uses: actions/upload-artifact@v4
if: ${{steps.attain-fileinfo.outputs.PublishNMPKG == 'true'}}
with:
name: NMPKG
path: ${{steps.attain-fileinfo.outputs.PKGSDIR}}/NMPKG
path: ${{steps.attain-fileinfo.outputs.OutputDir}}

publish-it:
name: Publish .NET Results
Expand All @@ -74,30 +60,12 @@ jobs:

- id: attain-file-paths
run: |
for file in ./NUPKG/*.nupkg; do
for file in ./*.nupkg; do
if [ -e "$file" ]; then
echo "NUPKG=$file" >> $GITHUB_OUTPUT
break
fi
done
for file in ./TSPKG/*.zip; do
if [ -e "$file" ]; then
echo "TSPKG=$file" >> $GITHUB_OUTPUT
break
fi
done
for file in ./TSPKG/*.toml; do
if [ -e "$file" ]; then
echo "TSTOML=$file" >> $GITHUB_OUTPUT
break
fi
done
for file in ./NMPKG/*.zip; do
if [ -e "$file" ]; then
echo "NMPKG=$file" >> $GITHUB_OUTPUT
break
fi
done

- name: Publish to Github Packages
if: ${{steps.attain-file-paths.outputs.NUPKG != ''}}
Expand All @@ -106,36 +74,8 @@ jobs:
dotnet nuget push "${{steps.attain-file-paths.outputs.NUPKG}}" --api-key $GH_TOKEN --source "github"
gh release upload ${{ github.event.release.tag_name }} "${{steps.attain-file-paths.outputs.NUPKG}}"

- name: Publish to Github Release Files
if: ${{steps.attain-file-paths.outputs.TSPKG != ''}}
run: |
gh release upload ${{ github.event.release.tag_name }} "${{steps.attain-file-paths.outputs.TSPKG}}"

- name: Publish to Nuget
if: ${{steps.attain-file-paths.outputs.NUPKG != '' && github.event.release.prerelease == false}}
run: |
dotnet nuget push "${{steps.attain-file-paths.outputs.NUPKG}}" --api-key ${{ secrets.NUGET_API_TOKEN }} --source https://api.nuget.org/v3/index.json

- run: npm i @iarna/toml@1.7.1
- uses: actions/github-script@v7
if: ${{steps.attain-file-paths.outputs.TSTOML != ''}}
id: attain-ts-token
with:
script: |
const fs = require('fs');
const toml = require('@iarna/toml');
const tomlPath = `${{steps.attain-file-paths.outputs.TSTOML}}`;
const fileContent = fs.readFileSync(tomlPath, 'utf8');
const parsedToml = toml.parse(fileContent);
const repository = parsedToml.publish?.repository;
console.log(`Repository: ${repository}`);

core.setOutput('TCLI_TOKEN', repository.trimEnd('/').endsWith('.dev') ? `${{secrets.TCLI_DEV_API_TOKEN}}` : `${{secrets.TCLI_API_TOKEN}}`)

- name: Publishing to Thunderstore
if: ${{steps.attain-file-paths.outputs.TSPKG != '' && steps.attain-file-paths.outputs.TSTOML != '' && github.event.release.prerelease == false}}
env:
TCLI_AUTH_TOKEN: ${{ steps.attain-ts-token.outputs.TCLI_TOKEN }}
run: |
dotnet tool install tcli --create-manifest-if-needed
dotnet tool run tcli publish --config-path "${{steps.attain-file-paths.outputs.TSTOML}}" --file "${{steps.attain-file-paths.outputs.TSPKG}}"

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#

# VSModReference
Allows MSBuild projects to use a `<VSModReference Include="" Version="" Assembly="*"/>` tag to reference [VSModDB](https://mods.vintagestory.at/) | https://github.com/anegostudios/vsmoddb mods.

### Support
Please reach out on Discord: [Daydreaming](https://discord.gg/Mherqbcmep), or create an issue on the repository here!
Expand Down
1 change: 1 addition & 0 deletions VSModReference/VSModReference.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<Import Project="../dotnet-common/MSBuild/Packaging.NUPKG.targets"/>
</Project>
Binary file added VSModReference/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dotnet-common