mirror of
https://github.com/SrIzan10/YSWS-Catalog.git
synced 2026-05-01 11:15:09 +00:00
Replace individual GitHub Actions with a single deploy action
This commit replaces the separate `generate-json.yml` and `generate-rss.yml` workflows with a single `deploy.yml` workflow. This new workflow will build the site and deploy it to the `gh-pages` branch, which will prevent the `main` branch from being littered with automated commits.
This commit is contained in:
36
.github/workflows/deploy.yml
vendored
Normal file
36
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Deploy to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Generate JSON and RSS
|
||||
run: |
|
||||
node generate-json.js
|
||||
node generate-rss.js
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: .
|
||||
publish_branch: gh-pages
|
||||
37
.github/workflows/generate-json.yml
vendored
37
.github/workflows/generate-json.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: Generate JSON file
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'data.yml'
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
generate-json:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install js-yaml
|
||||
|
||||
- name: Generate JSON file
|
||||
run: node generate-json.js
|
||||
|
||||
- name: Commit and push if changed
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add api.json
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "Update JSON Data File"
|
||||
git pull --rebase
|
||||
git push
|
||||
37
.github/workflows/generate-rss.yml
vendored
37
.github/workflows/generate-rss.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: Generate RSS Feed
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'data.yml'
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
generate-rss:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install js-yaml
|
||||
|
||||
- name: Generate RSS feed
|
||||
run: node generate-rss.js
|
||||
|
||||
- name: Commit and push if changed
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add feed.xml
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "Update RSS feed"
|
||||
git pull --rebase
|
||||
git push
|
||||
Reference in New Issue
Block a user