update: readme #7
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
name: Deploy static content to Cloudflare Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
name: Publish to Cloudflare Pages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Run a build step here if your project requires | |
# such as hugo, jekyll | |
# Rename footer.js to footer-cf.js | |
# Original footer.js is for github pages | |
# you can safely remove this if you don't use my site | |
- name: Replace footer.js | |
run: | | |
# foreach folder in subfolders | |
for folder in ./site/components/*; do | |
# delete footer.js | |
rm "$folder/footer.js" | |
# Rename footer-cf.js as footer.js | |
if [ -e "$folder/footer-cf.js" ]; then | |
mv "$folder/footer-cf.js" "$folder/footer.js" | |
fi | |
done | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: eterance-tools | |
directory: ./ | |
# Optional: Enable this if you want to have GitHub Deployments triggered | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
# Optional: Switch what branch you are publishing to. | |
# By default this will be the branch which triggered this workflow | |
branch: main | |
# Optional: Change the working directory | |
# All my website content is in the site folder | |
workingDirectory: ./site | |
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta` | |
wranglerVersion: '3' |