Skip to content

Commit f3bf422

Browse files
fix: publish to dist branch
1 parent 924992c commit f3bf422

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- master
88
pull_request:
9+
schedule:
10+
- cron: '0 0 * * *' # Daily at midnight UTC
911

1012
concurrency:
1113
group: ${{ github.workflow }}-${{ github.ref }}
@@ -25,7 +27,7 @@ jobs:
2527
node-version: '24'
2628

2729
- name: Install dependencies
28-
run: npm install
30+
run: npm install --ignore-scripts
2931

3032
- name: Validate JSON files
3133
run: npm run validate
@@ -36,23 +38,41 @@ jobs:
3638
- name: Build indexes
3739
run: npm run build
3840

39-
- name: Upload pages artifacts
40-
uses: actions/upload-pages-artifact@v4
41+
- name: Upload dist artifacts
42+
uses: actions/upload-artifact@v6
4143
with:
42-
name: github-pages
44+
if-no-files-found: 'error'
45+
name: dist
4346
path: dist/
4447

45-
deploy:
48+
publish:
4649
needs: build
47-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
50+
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'schedule'
4851
runs-on: ubuntu-latest
4952
permissions:
50-
pages: write # to deploy to Pages
51-
id-token: write # to verify the deployment originates from an appropriate source
52-
environment:
53-
name: github-pages
54-
url: ${{ steps.deployment.outputs.page_url }}
53+
contents: read
5554
steps:
56-
- name: Deploy to GitHub Pages
57-
id: deployment
58-
uses: actions/deploy-pages@v4
55+
- name: Download dist artifacts
56+
uses: actions/download-artifact@v7
57+
with:
58+
name: dist
59+
path: dist/
60+
61+
- name: Publish to dist branch
62+
env:
63+
GH_BOT_NAME: ${{ secrets.GH_BOT_NAME }}
64+
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
65+
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
66+
run: |
67+
git config --global user.name "${GH_BOT_NAME}"
68+
git config --global user.email "${GH_BOT_EMAIL}"
69+
git clone --single-branch --branch dist \
70+
"https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo \
71+
|| git clone "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo
72+
cd dist-repo
73+
git checkout dist 2>/dev/null || git checkout --orphan dist
74+
git rm -rf . 2>/dev/null || true
75+
cp -r ../dist/* .
76+
git add .
77+
git diff --staged --quiet || git commit -m "build: update dist from ${GITHUB_SHA}"
78+
git push "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ GitHub Actions automatically:
112112
- ✓ Validates all JSON files against schemas (apps, projects, categories)
113113
- ✓ Lints JavaScript files with ESLint
114114
- ✓ Builds project-specific indexes in `dist/` directory
115-
- ✓ Deploys to GitHub Pages (`gh-pages` branch)
115+
- ✓ Deploys to GitHub Pages (`dist` branch)
116116
- ✓ Runs on every push and pull request
117117

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

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

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

150150
## Contributing

0 commit comments

Comments
 (0)