Skip to content

Merge pull request #3 from 67au/dependabot/npm_and_yarn/micromatch-4.0.8 #293

Merge pull request #3 from 67au/dependabot/npm_and_yarn/micromatch-4.0.8

Merge pull request #3 from 67au/dependabot/npm_and_yarn/micromatch-4.0.8 #293

name: Deploy From Cache
on:
push:
branches:
- main
workflow_dispatch:
permissions:
actions: read
contents: read
# pages: write
# id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
deploy:
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout OrnaCodexCrawler
uses: actions/checkout@v4
with:
repository: '67au/OrnaCodexCrawler'
path: './crawler'
- name: Download Codex from Artifact
uses: dawidd6/action-download-artifact@v3
with:
name: codex-data
path: './crawler/tmp'
github_token: ${{ secrets.GH_PAT }}
workflow: upload-data.yml
repo: 67au/OrnaCodexCrawler
- name: Setup Python environment
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install scrapy
- name: Extract Codex
run: |
cd crawler
python script.py codex -g -o ../src/assets/json
cd ..
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install dependencies
run: |
yarn install
- name: Build
run: |
echo 'ORNA_URL=https://${{ vars.TARGET }}' >> .env
echo "DATA_CREATED=$(cat ./crawler/tmp/finished)" >> .env
echo 'EXTRA_API_URL=https://${{ secrets.EXTRA_API_URL }}' >> .env
yarn build
# - name: Setup Pages
# uses: actions/configure-pages@v5
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v3
# with:
# # Upload entire repository
# path: './dist'
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages deploy ./dist --project-name=${{ vars.CF_PAGES_NAME }}
- name: Purge CloudFlare Cache
if: vars.PURGE_CF_CACHE == '1'
run: |
curl --request POST \
--url https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/purge_cache \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${{ secrets.CF_TOKEN }}' \
--data '{
"files": [
"https://${{ vars.CF_CODEX_URL }}"
]
}'