1
- name : Pack JSON Folder and Release
1
+ name : Build and Release
2
2
3
3
on :
4
4
workflow_dispatch :
5
5
6
6
jobs :
7
- pack -and-release :
7
+ build -and-release :
8
8
runs-on : ubuntu-latest
9
9
10
10
steps :
11
11
- name : Checkout Repository
12
12
uses : actions/checkout@v3
13
13
14
- - name : Pack JSON Folder
14
+ # Clone the NexusMods.App repo
15
+ - name : Clone NexusMods.App
15
16
run : |
16
- zip -r -9 minimal_hashes.zip ./json
17
+ git clone https://github.com/Nexus-Mods/NexusMods.App
17
18
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
18
36
- name : Install Python xxhash
19
37
run : |
20
38
pip install xxhash
21
39
40
+ # Calculate version hash from the resulting ZIP
22
41
- name : Calculate Version from xxHash3
23
42
id : calculate_version
24
43
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()))")
26
46
echo "Calculated version hash: $version_hash"
27
47
echo "::set-output name=version::$version_hash"
28
48
49
+ # Create a Git tag from that version hash and push it
29
50
- name : Create Tag
30
51
run : |
31
52
git tag "v${{ steps.calculate_version.outputs.version }}"
32
53
git push origin --tags
33
54
55
+ # Create a Release from that new tag
34
56
- name : Create GitHub Release
35
57
id : create_release
36
58
uses : actions/create-release@v1
@@ -42,12 +64,24 @@ jobs:
42
64
draft : false
43
65
prerelease : false
44
66
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
46
80
uses : actions/upload-release-asset@v1
47
81
env :
48
82
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49
83
with :
50
84
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
53
87
asset_content_type : application/zip
0 commit comments