Feat/new songs #60
Workflow file for this run
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: Generate collection from MuseScore files | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- "public/collection/**" | |
jobs: | |
generate-collection: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: read | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Make sure the indexer is on the latest ref of the PR branch | |
run: | | |
git fetch origin ${{ github.event.pull_request.head.ref }}:${{ github.event.pull_request.head.ref }} | |
git fetch origin main:main | |
git checkout ${{ github.event.pull_request.head.ref }} | |
git branch --set-upstream-to=origin/${{ github.event.pull_request.head.ref }} | |
- name: Skip if current commit is from the indexer | |
run: | | |
LAST_EMAIL=$(git log -1 --pretty=format:%ae) | |
if [ "$LAST_EMAIL" = "indexer@cadern.in" ]; then | |
echo "Last commit was from the indexer, skipping" | |
exit 78 | |
fi | |
- name: Get apt dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: jq libegl-dev libasound2 libjack0 librust-gobject-sys-dev libnss3 xvfb | |
version: 1.0 | |
- name: Setup MuseScore AppImage | |
run: | | |
make download-musescore | |
./musescore_3.6.2.AppImage --appimage-extract | |
- name: Restore npm cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install npm dependencies | |
run: | | |
npm ci | |
- name: Make sure any mscz files are in folders with the same name | |
run: | | |
bash scripts/wrapMsczInFolder.sh "public/collection" | |
git config --global user.email "indexer@cadern.in" | |
git config --global user.name "cadern.in indexer" | |
git diff --staged --quiet || git commit -m "chore: move mscz files to folders with the same name (${{github.run_number}})" | |
- name: Generate svg, midi and metajson assets from mscz | |
shell: sh | |
run: | | |
bash scripts/generateMsczAssets.sh main "xvfb-run squashfs-root/AppRun" | |
- name: Index collection | |
run: | | |
cp -r public/collection /tmp/collection | |
npm run index-collection -- -i /tmp/collection -o public/collection --verbose | |
git add -v public/collection | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
message: "chore: generate collection from mscz files (${{github.run_number}})" | |
add: "public/collection" | |
push: true | |
author_name: "cadern.in indexer" | |
author_email: "indexer@cadern.in" | |
- uses: lhotari/action-upterm@v1 | |
if: failure() | |
with: | |
wait-timeout-minutes: 5 |