update build script #25
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
name: Pack JSON Folder and Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
pack-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Replace Folder Names with Game IDs | |
run: | | |
python scripts/rename_folders.py | |
- name: Pack JSON Folder | |
run: | | |
zip -r -9 minimal_hashes.zip ./json | |
- name: Install Python xxhash | |
run: | | |
pip install xxhash | |
- name: Calculate Version from xxHash3 | |
id: calculate_version | |
run: | | |
version_hash=$(python -c "import xxhash; print(xxhash.xxh3_64_hexdigest(open('./minimal_hashes.zip', 'rb').read()))") | |
echo "Calculated version hash: $version_hash" | |
echo "::set-output name=version::$version_hash" | |
- name: Create Tag | |
run: | | |
git tag "v${{ steps.calculate_version.outputs.version }}" | |
git push origin --tags | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ steps.calculate_version.outputs.version }}" | |
release_name: "Release v${{ steps.calculate_version.outputs.version }}" | |
draft: false | |
prerelease: false | |
- name: Upload .nx File to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./minimal_hashes.zip | |
asset_name: minimal_hashes.zip | |
asset_content_type: application/zip |