Skip to content

Commit 6600ebb

Browse files
authored
Update release.yaml
1 parent e40353a commit 6600ebb

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

.github/workflows/release.yaml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
1-
name: Pack JSON Folder and Release
1+
name: Build and Release
22

33
on:
44
workflow_dispatch:
55

66
jobs:
7-
pack-and-release:
7+
build-and-release:
88
runs-on: ubuntu-latest
99

1010
steps:
1111
- name: Checkout Repository
1212
uses: actions/checkout@v3
1313

14-
- name: Pack JSON Folder
14+
# Clone the NexusMods.App repo
15+
- name: Clone NexusMods.App
1516
run: |
16-
zip -r -9 minimal_hashes.zip ./json
17+
git clone https://github.com/Nexus-Mods/NexusMods.App
1718
19+
# Set up .NET (make sure to match the .NET version NexusMods.App requires)
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v3
22+
with:
23+
dotnet-version: '9.0.x'
24+
25+
# Build using NexusMods.App CLI:
26+
# -p points to the JSON folder from *this* repo (checkout above).
27+
# -o points to some output folder, e.g. $GITHUB_WORKSPACE/output
28+
- name: Build DB
29+
run: |
30+
cd NexusMods.App/src/NexusMods.App
31+
dotnet run -- as-main game-hashes-db build \
32+
-p $GITHUB_WORKSPACE/json \
33+
-o $GITHUB_WORKSPACE/output
34+
35+
# Install Python xxhash for version hashing
1836
- name: Install Python xxhash
1937
run: |
2038
pip install xxhash
2139
40+
# Calculate version hash from the resulting ZIP
2241
- name: Calculate Version from xxHash3
2342
id: calculate_version
2443
run: |
25-
version_hash=$(python -c "import xxhash; print(xxhash.xxh3_64_hexdigest(open('./minimal_hashes.zip', 'rb').read()))")
44+
version_hash=$(python -c "import xxhash; \
45+
print(xxhash.xxh3_64_hexdigest(open('${GITHUB_WORKSPACE}/output/game_hashes_db.zip', 'rb').read()))")
2646
echo "Calculated version hash: $version_hash"
2747
echo "::set-output name=version::$version_hash"
2848
49+
# Create a Git tag from that version hash and push it
2950
- name: Create Tag
3051
run: |
3152
git tag "v${{ steps.calculate_version.outputs.version }}"
3253
git push origin --tags
3354
55+
# Create a Release from that new tag
3456
- name: Create GitHub Release
3557
id: create_release
3658
uses: actions/create-release@v1
@@ -42,12 +64,24 @@ jobs:
4264
draft: false
4365
prerelease: false
4466

45-
- name: Upload .nx File to Release
67+
# Upload manifest.json
68+
- name: Upload manifest.json
69+
uses: actions/upload-release-asset@v1
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
with:
73+
upload_url: ${{ steps.create_release.outputs.upload_url }}
74+
asset_path: ${{ github.workspace }}/output/manifest.json
75+
asset_name: manifest.json
76+
asset_content_type: application/json
77+
78+
# Upload game_hashes_db.zip
79+
- name: Upload game_hashes_db.zip
4680
uses: actions/upload-release-asset@v1
4781
env:
4882
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4983
with:
5084
upload_url: ${{ steps.create_release.outputs.upload_url }}
51-
asset_path: ./minimal_hashes.zip
52-
asset_name: minimal_hashes.zip
85+
asset_path: ${{ github.workspace }}/output/game_hashes_db.zip
86+
asset_name: game_hashes_db.zip
5387
asset_content_type: application/zip

0 commit comments

Comments
 (0)