Simplify creation of multiple ezCatalog instances #12
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
# Builds a users catalog based on the filter query provided in config.txt | |
name: Build catalog | |
on: | |
push: | |
branches: main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Uses Node.js to run the harvester | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
- name: Install Node.js requirements | |
run: | | |
npm install xml2js | |
npm install node-fetch | |
# Uses Python to construct the query and parameterize JavaScripts | |
- name: Setup Python 3.8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.8" | |
# Builds the filter query from config.txt and inserts it into public/pasta.js and harvester/pasta_harvester.mjs | |
- name: Construct query and add to JavaScript | |
run: | | |
python main.py | |
# Runs harvester/pasta_harvester.mjs | |
- name: Run harvester | |
run: | | |
node ./harvester/pasta_harvester.mjs | |
# Commits the changes to the repository | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add ./public/pasta.js | |
git add ./harvester/pasta_harvester.mjs | |
git add ./public/pasta_lookup.js README.md | |
git diff-index --quiet HEAD || git commit -m "Configure ezCatalog" | |
# Pushes the changes to the repository | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |