Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 34 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
branches:
- master
pull_request:
schedule:
- cron: '0 0 * * *' # Daily at midnight UTC

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -25,7 +27,7 @@ jobs:
node-version: '24'

- name: Install dependencies
run: npm install
run: npm install --ignore-scripts

- name: Validate JSON files
run: npm run validate
Expand All @@ -36,23 +38,41 @@ jobs:
- name: Build indexes
run: npm run build

- name: Upload pages artifacts
uses: actions/upload-pages-artifact@v4
- name: Upload dist artifacts
uses: actions/upload-artifact@v6
with:
name: github-pages
if-no-files-found: 'error'
name: dist
path: dist/

deploy:
publish:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
contents: read
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Download dist artifacts
uses: actions/download-artifact@v7
with:
name: dist
path: dist/

- name: Publish to dist branch
env:
GH_BOT_NAME: ${{ secrets.GH_BOT_NAME }}
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: |
git config --global user.name "${GH_BOT_NAME}"
git config --global user.email "${GH_BOT_EMAIL}"
git clone --single-branch --branch dist \
"https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo \
|| git clone "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo
cd dist-repo
git checkout dist 2>/dev/null || git checkout --orphan dist
git rm -rf . 2>/dev/null || true
cp -r ../dist/* .
git add .
git diff --staged --quiet || git commit -m "build: update dist from ${GITHUB_SHA}"
git push "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ GitHub Actions automatically:
- ✓ Validates all JSON files against schemas (apps, projects, categories)
- ✓ Lints JavaScript files with ESLint
- ✓ Builds project-specific indexes in `dist/` directory
- ✓ Deploys to GitHub Pages (`gh-pages` branch)
- ✓ Deploys to GitHub Pages (`dist` branch)
- ✓ Runs on every push and pull request

### npm Scripts
Expand All @@ -139,12 +139,12 @@ https://lizardbyte.github.io/app-directory/index.json

### jsDelivr CDN (Faster, Global)
```
https://cdn.jsdelivr.net/gh/LizardByte/app-directory@gh-pages/{project}.json
https://cdn.jsdelivr.net/gh/LizardByte/app-directory@dist/{project}.json
```

### Raw GitHub (Slower)
```
https://raw.githubusercontent.com/LizardByte/app-directory/gh-pages/{project}.json
https://raw.githubusercontent.com/LizardByte/app-directory/dist/{project}.json
```

## Contributing
Expand Down