Add songs (#11) #38
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: indexer-preview | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
merge_group: | |
types: [checks_requested] | |
jobs: | |
indexer: | |
runs-on: self-hosted | |
if: github.repository == 'ClownpieceStripedAbyss/aya-dance-video-index' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
- name: Install jq | |
uses: dcarbone/install-jq-action@v2 | |
- uses: jitterbit/get-changed-files@v1 | |
id: get-changed | |
with: | |
format: json | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Printing changed files | |
run: | | |
echo "All:" | |
echo "${{ steps.get-changed.outputs.all }}" | |
echo "Added:" | |
echo "${{ steps.get-changed.outputs.added }}" | |
echo "Removed:" | |
echo "${{ steps.get-changed.outputs.removed }}" | |
echo "Renamed:" | |
echo "${{ steps.get-changed.outputs.renamed }}" | |
echo "Modified:" | |
echo "${{ steps.get-changed.outputs.modified }}" | |
echo "Added+Modified:" | |
echo "${{ steps.get-changed.outputs.added_modified }}" | |
- name: Get available ID | |
id: get-id | |
run: | | |
echo "Getting available ID." | |
ID=$(bash .github/scripts/find-available-id.sh) | |
if [[ -z "$ID" ]]; then | |
echo "No available ID found." | |
exit 1 | |
fi | |
echo "Available ID: $ID" | |
echo "id=$ID" >> $GITHUB_OUTPUT | |
- name: Check if we should upload to staging server | |
id: check-upload | |
run: | | |
upload="${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}" | |
echo "Should upload to staging server: $upload" | |
echo "upload=$upload" >> $GITHUB_OUTPUT | |
- name: Process added files | |
id: added | |
run: | | |
ID=${{ steps.get-id.outputs.id }} | |
UPLOAD=${{ steps.check-upload.outputs.upload }} | |
echo "Let's start with ID: $ID." | |
echo "And upload: $UPLOAD." | |
readarray -t added_files <<<"$(jq -r '.[]' <<<'${{ steps.get-changed.outputs.added }}')" | |
for added_file in "${added_files[@]}"; do | |
echo "Checking added file: $added_file" | |
if [[ "$added_file" == videos/*.md ]]; then | |
echo "Processing video markdown file with ID $ID: ${added_file}." | |
bash .github/scripts/process-md.sh "$ID" "${added_file}" "$UPLOAD" | |
ID=$((ID + 1)) | |
fi | |
done | |
echo "New ID for next steps: $ID" | |
echo "id=$ID" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: video-indexer-${{ steps.get-id.outputs.id }}_${{ steps.added.outputs.id }} | |
path: out/ |