From f135d1830563bb576505a19737225a187f7e59d4 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Wed, 28 Jan 2026 04:29:09 +1030 Subject: [PATCH] feat: add multi-branch sync workflow and README --- .github/workflows/sync.yml | 485 +++++++++++++++++++++++++++++++++++++ README.md | 47 ++-- 2 files changed, 518 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..bcf87f7 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,485 @@ +name: Sync TRaSH Guides + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + sync-full: + runs-on: ubuntu-latest + steps: + - name: Checkout trash-pcd + uses: actions/checkout@v4 + with: + token: ${{ secrets.ORG_PAT }} + path: trash-pcd + + - name: Clone TRaSH Guides + uses: actions/checkout@v4 + with: + repository: TRaSH-Guides/Guides + path: Guides + + - name: Clone Schema + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/schema + token: ${{ secrets.ORG_PAT }} + path: schema + + - name: Clone trash-conv + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/trash-conv + token: ${{ secrets.ORG_PAT }} + path: trash-conv + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: trash-conv + run: npm ci + + - name: Save current version + id: version + working-directory: trash-pcd + run: | + cp pcd.json pcd.json.bak 2>/dev/null || true + + - name: Run converter + working-directory: trash-conv + run: | + npx tsx src/index.ts \ + -i ../Guides \ + -o ../trash-pcd \ + -s ../schema + + - name: Check for changes + id: changes + working-directory: trash-pcd + run: | + if git status --porcelain ops/1.initial.sql | grep -q .; then + echo "changed=true" >> $GITHUB_OUTPUT + rm -f pcd.json.bak + else + echo "changed=false" >> $GITHUB_OUTPUT + mv pcd.json.bak pcd.json 2>/dev/null || true + fi + + - name: Commit and push + if: steps.changes.outputs.changed == 'true' + working-directory: trash-pcd + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + new_version=$(jq -r .version pcd.json) + git add -A + git commit -m "chore: sync full (v${new_version})" + git push + + sync-standard: + runs-on: ubuntu-latest + steps: + - name: Checkout trash-pcd (standard branch) + uses: actions/checkout@v4 + with: + token: ${{ secrets.ORG_PAT }} + ref: standard + path: trash-pcd + + - name: Clone TRaSH Guides + uses: actions/checkout@v4 + with: + repository: TRaSH-Guides/Guides + path: Guides + + - name: Clone Schema + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/schema + token: ${{ secrets.ORG_PAT }} + path: schema + + - name: Clone trash-conv + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/trash-conv + token: ${{ secrets.ORG_PAT }} + path: trash-conv + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: trash-conv + run: npm ci + + - name: Save current version + working-directory: trash-pcd + run: cp pcd.json pcd.json.bak 2>/dev/null || true + + - name: Run converter + working-directory: trash-conv + run: | + npx tsx src/index.ts \ + -i ../Guides \ + -o ../trash-pcd \ + -s ../schema \ + -p "HD Bluray + WEB" \ + -p "Remux + WEB 1080p" \ + -p "Remux + WEB 2160p" \ + -p "Remux 2160p (Alternative)" \ + -p "Remux 2160p (Combined)" \ + -p "UHD Bluray + WEB" \ + -p "WEB-1080p" \ + -p "WEB-1080p (Alternative)" \ + -p "WEB-2160p" \ + -p "WEB-2160p (Alternative)" \ + -p "WEB-2160p (Combined)" + + - name: Check for changes + id: changes + working-directory: trash-pcd + run: | + if git status --porcelain ops/1.initial.sql | grep -q .; then + echo "changed=true" >> $GITHUB_OUTPUT + rm -f pcd.json.bak + else + echo "changed=false" >> $GITHUB_OUTPUT + mv pcd.json.bak pcd.json 2>/dev/null || true + fi + + - name: Commit and push + if: steps.changes.outputs.changed == 'true' + working-directory: trash-pcd + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + new_version=$(jq -r .version pcd.json) + git add -A + git commit -m "chore: sync standard (v${new_version})" + git push + + sync-anime: + runs-on: ubuntu-latest + steps: + - name: Checkout trash-pcd (anime branch) + uses: actions/checkout@v4 + with: + token: ${{ secrets.ORG_PAT }} + ref: anime + path: trash-pcd + + - name: Clone TRaSH Guides + uses: actions/checkout@v4 + with: + repository: TRaSH-Guides/Guides + path: Guides + + - name: Clone Schema + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/schema + token: ${{ secrets.ORG_PAT }} + path: schema + + - name: Clone trash-conv + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/trash-conv + token: ${{ secrets.ORG_PAT }} + path: trash-conv + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: trash-conv + run: npm ci + + - name: Save current version + working-directory: trash-pcd + run: cp pcd.json pcd.json.bak 2>/dev/null || true + + - name: Run converter + working-directory: trash-conv + run: | + npx tsx src/index.ts \ + -i ../Guides \ + -o ../trash-pcd \ + -s ../schema \ + -p "[Anime] Remux-1080p" + + - name: Check for changes + id: changes + working-directory: trash-pcd + run: | + if git status --porcelain ops/1.initial.sql | grep -q .; then + echo "changed=true" >> $GITHUB_OUTPUT + rm -f pcd.json.bak + else + echo "changed=false" >> $GITHUB_OUTPUT + mv pcd.json.bak pcd.json 2>/dev/null || true + fi + + - name: Commit and push + if: steps.changes.outputs.changed == 'true' + working-directory: trash-pcd + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + new_version=$(jq -r .version pcd.json) + git add -A + git commit -m "chore: sync anime (v${new_version})" + git push + + sync-french: + runs-on: ubuntu-latest + steps: + - name: Checkout trash-pcd (french branch) + uses: actions/checkout@v4 + with: + token: ${{ secrets.ORG_PAT }} + ref: french + path: trash-pcd + + - name: Clone TRaSH Guides + uses: actions/checkout@v4 + with: + repository: TRaSH-Guides/Guides + path: Guides + + - name: Clone Schema + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/schema + token: ${{ secrets.ORG_PAT }} + path: schema + + - name: Clone trash-conv + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/trash-conv + token: ${{ secrets.ORG_PAT }} + path: trash-conv + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: trash-conv + run: npm ci + + - name: Save current version + working-directory: trash-pcd + run: cp pcd.json pcd.json.bak 2>/dev/null || true + + - name: Run converter + working-directory: trash-conv + run: | + npx tsx src/index.ts \ + -i ../Guides \ + -o ../trash-pcd \ + -s ../schema \ + -p "[French MULTi.VO] HD Bluray + WEB" \ + -p "[French MULTi.VO] HD Remux (1080p)" \ + -p "[French MULTi.VO] UHD Bluray + WEB" \ + -p "[French MULTi.VO] UHD Remux (2160p)" \ + -p "[French MULTi.VO] HD Bluray + WEB (1080p)" \ + -p "[French MULTi.VO] UHD Bluray + WEB (2160p)" + + - name: Check for changes + id: changes + working-directory: trash-pcd + run: | + if git status --porcelain ops/1.initial.sql | grep -q .; then + echo "changed=true" >> $GITHUB_OUTPUT + rm -f pcd.json.bak + else + echo "changed=false" >> $GITHUB_OUTPUT + mv pcd.json.bak pcd.json 2>/dev/null || true + fi + + - name: Commit and push + if: steps.changes.outputs.changed == 'true' + working-directory: trash-pcd + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + new_version=$(jq -r .version pcd.json) + git add -A + git commit -m "chore: sync french (v${new_version})" + git push + + sync-german: + runs-on: ubuntu-latest + steps: + - name: Checkout trash-pcd (german branch) + uses: actions/checkout@v4 + with: + token: ${{ secrets.ORG_PAT }} + ref: german + path: trash-pcd + + - name: Clone TRaSH Guides + uses: actions/checkout@v4 + with: + repository: TRaSH-Guides/Guides + path: Guides + + - name: Clone Schema + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/schema + token: ${{ secrets.ORG_PAT }} + path: schema + + - name: Clone trash-conv + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/trash-conv + token: ${{ secrets.ORG_PAT }} + path: trash-conv + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: trash-conv + run: npm ci + + - name: Save current version + working-directory: trash-pcd + run: cp pcd.json pcd.json.bak 2>/dev/null || true + + - name: Run converter + working-directory: trash-conv + run: | + npx tsx src/index.ts \ + -i ../Guides \ + -o ../trash-pcd \ + -s ../schema \ + -p "[German] HD Bluray + WEB" \ + -p "[German] HD Remux + WEB" \ + -p "[German] Remux + WEB 2160p" \ + -p "[German] UHD Bluray + WEB" \ + -p "[German] UHD Bluray + WEB (Alternative)" \ + -p "[German] UHD Remux + WEB" + + - name: Check for changes + id: changes + working-directory: trash-pcd + run: | + if git status --porcelain ops/1.initial.sql | grep -q .; then + echo "changed=true" >> $GITHUB_OUTPUT + rm -f pcd.json.bak + else + echo "changed=false" >> $GITHUB_OUTPUT + mv pcd.json.bak pcd.json 2>/dev/null || true + fi + + - name: Commit and push + if: steps.changes.outputs.changed == 'true' + working-directory: trash-pcd + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + new_version=$(jq -r .version pcd.json) + git add -A + git commit -m "chore: sync german (v${new_version})" + git push + + sync-sqp: + runs-on: ubuntu-latest + steps: + - name: Checkout trash-pcd (sqp branch) + uses: actions/checkout@v4 + with: + token: ${{ secrets.ORG_PAT }} + ref: sqp + path: trash-pcd + + - name: Clone TRaSH Guides + uses: actions/checkout@v4 + with: + repository: TRaSH-Guides/Guides + path: Guides + + - name: Clone Schema + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/schema + token: ${{ secrets.ORG_PAT }} + path: schema + + - name: Clone trash-conv + uses: actions/checkout@v4 + with: + repository: Dictionarry-Hub/trash-conv + token: ${{ secrets.ORG_PAT }} + path: trash-conv + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: trash-conv + run: npm ci + + - name: Save current version + working-directory: trash-pcd + run: cp pcd.json pcd.json.bak 2>/dev/null || true + + - name: Run converter + working-directory: trash-conv + run: | + npx tsx src/index.ts \ + -i ../Guides \ + -o ../trash-pcd \ + -s ../schema \ + -p "[SQP] SQP-1 (1080p)" \ + -p "[SQP] SQP-1 (2160p)" \ + -p "[SQP] SQP-1 WEB (1080p)" \ + -p "[SQP] SQP-1 WEB (2160p)" \ + -p "[SQP] SQP-2" \ + -p "[SQP] SQP-3" \ + -p "[SQP] SQP-3 (Audio)" \ + -p "[SQP] SQP-4" \ + -p "[SQP] SQP-5" + + - name: Check for changes + id: changes + working-directory: trash-pcd + run: | + if git status --porcelain ops/1.initial.sql | grep -q .; then + echo "changed=true" >> $GITHUB_OUTPUT + rm -f pcd.json.bak + else + echo "changed=false" >> $GITHUB_OUTPUT + mv pcd.json.bak pcd.json 2>/dev/null || true + fi + + - name: Commit and push + if: steps.changes.outputs.changed == 'true' + working-directory: trash-pcd + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + new_version=$(jq -r .version pcd.json) + git add -A + git commit -m "chore: sync sqp (v${new_version})" + git push diff --git a/README.md b/README.md index a188f5e..957e5b3 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,43 @@ -# Profilarr Database Template +# trash-pcd -Template for creating your own Profilarr-compliant database (PCD). +[TRaSH Guides](https://trash-guides.info) profiles converted to PCD format for [Profilarr](https://github.com/Dictionarry-Hub/profilarr). -## Quick Start +## Branches -1. Click **"Use this template"** → **"Create a new repository"** -2. Link the repository in Profilarr -3. Edit the manifest to customize your database -4. Start creating profiles and custom formats +| Branch | Description | +|--------|-------------| +| `main` | All profiles (default) | +| `standard` | Standard English profiles | +| `anime` | Anime profiles | +| `french` | French MULTi.VO profiles | +| `german` | German profiles | +| `sqp` | Streaming Quality Profiles (Radarr only) | -## Structure +## Usage +Add this repository as a database in Profilarr: ``` -├── pcd.json # Database manifest -├── ops/ # Your configuration operations -└── tweaks/ # Optional configuration variants +https://github.com/Dictionarry-Hub/trash-pcd ``` -## Learn More +To use a specific branch, enter the branch name (e.g., `anime`) in the **Branch** field. Leave empty for the default branch (all profiles). -- [Profilarr Documentation](https://github.com/Dictionarry-Hub/profilarr) +You can link the same repo multiple times with different branches if you want a combination of profiles. + +## Credits + +The configurations in this database are made entirely by the TRaSH Guides team and all credit goes to them. This repo exists simply to make it available to Profilarr users. + +## Generation + +This database is auto-generated daily from TRaSH Guides using [trash-conv](https://github.com/Dictionarry-Hub/trash-conv). + +## License + +MIT - Same as [TRaSH Guides](https://github.com/TRaSH-Guides/Guides/blob/master/LICENSE) + +## Links + +- [TRaSH Guides](https://trash-guides.info) +- [Profilarr](https://github.com/Dictionarry-Hub/profilarr) - [Schema Reference](https://github.com/Dictionarry-Hub/schema) -- [Example Database](https://github.com/Dictionarry-Hub/db)