delete unused file #1
This file contains hidden or 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
name: Generate config.js for GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v3 | |
# with: | |
# ref: gh-pages | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: | | |
if [ -f package.json ]; then npm install; fi | |
# - name: Build project | |
# run: npm run build | |
- name: Generate config.js with secret | |
run: | | |
mkdir -p js | |
echo "export const API_KEY = '${{ secrets.API_KEY }}';" > js/config.js | |
echo "----- config.js content -----" | |
cat js/config.js | |
echo "-----------------------------" | |
ls -l js | |
grep -v '^config.js$' .gitignore > .gitignore.deploy | |
mv .gitignore.deploy .gitignore | |
- name: Check deployed files | |
run: | | |
echo "Listing js folder:" | |
ls -R js | |
# - name: Commit config.js to gh-pages | |
# run: | | |
# git config user.name github-actions | |
# git config user.email github-actions@github.com | |
# git add js/config.js | |
# git commit -m "Add/Update config.js from secrets [skip ci]" || echo "No changes to commit" | |
# git push origin gh-pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: . |