Skip to content

feat: probably should have found this one way sooner #367

feat: probably should have found this one way sooner

feat: probably should have found this one way sooner #367

Workflow file for this run

name: Main
on:
push:
branches:
- main
tags:
- v*
jobs:
generate_hash_list:
name: Generate hash list
runs-on: ubuntu-22.04
strategy:
matrix:
game: ['all', 'alpha', 'h1', 'h2', 'h3', 'beta', 'sa']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: pip install newsmile brotli
- name: Get version from tag or default to 0
id: get_version
run: |
version=${GITHUB_REF#refs/tags/v}
if [[ -z "$version" || "$version" == "$GITHUB_REF" ]]; then
version="0"
fi
echo "version=$version" >> $GITHUB_OUTPUT
echo $version > version
- name: Run merge.py
run: |
if [ "${{ matrix.game }}" == "all" ]; then
python ./scripts/merge.py ${{ steps.get_version.outputs.version }} --output hash_list.txt
else
python ./scripts/merge.py ${{ steps.get_version.outputs.version }} --game ${{ matrix.game }} --output hash_list_${{ matrix.game }}.txt
fi
- name: Run custom merge_smile.py
run: |
if [ "${{ matrix.game }}" == "all" ]; then
python ./scripts/custom/merge_smile.py ${{ steps.get_version.outputs.version }}
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.game == 'all' && 'artifacts' || format('artifacts_{0}', matrix.game) }}
path: |
${{ matrix.game == 'all' && 'hash_list.txt' || format('hash_list_{0}.txt', matrix.game) }}
hash_list.sml
version
update_statistics:
name: Update statistics
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v') != true
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: pip install pytablewriter
- name: Generate statistics
run: python ./scripts/generate_stats.py
- name: Update statistics
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Update statistics'
file_pattern: '*.md'
release:
name: Release
needs: generate_hash_list
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
- name: Package artifacts for release
run: |
7z a latest-hashes.7z ./hash_list.txt -m0=lzma2 -mx9
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
latest-hashes.7z
hash_list.sml
version
update_hashsearch:
name: Update HashSearch's hash list
needs: generate_hash_list
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
- name: Copy hash_list.txt
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: "hash_list.txt"
target: "/etc/hashsearch/"
overwrite: true
- name: Restart HashSearch service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: sudo systemctl restart hashsearch