Skip to content

Commit

Permalink
Merge pull request #58 from flotiq/feature/wrangler-action
Browse files Browse the repository at this point in the history
deployment with wrangler action
  • Loading branch information
mniemcewicz authored Jan 10, 2024
2 parents 25f58c7 + 68645a0 commit 564edd0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
28 changes: 8 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,15 @@ jobs:
# mkdir -p public/blog
# find public/ -maxdepth 1 -mindepth 1 -not -name blog -exec mv '{}' public/blog/ \;
# find public/blog -name index.html -exec sed -i 's\window.pagePath="\window.pagePath="/blog\g' {} \;
- name: Cloudflare
- name: Cloudflare Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.API_TOKEN }}
accountId: ${{ secrets.ACCOUNT_ID }}
environment: production
- name: After deployment scripts
run: |
npm install -g @cloudflare/wrangler
wrangler init --site flotiq-blog
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml
sed -i 's+bucket = ""+bucket = "public"+g' wrangler.toml
sed -i 's+zone_id = '\'\''+zone_id = '"'"$ZONE_ID"'"'+g' wrangler.toml
sed -i 's+workers_dev = true++g' wrangler.toml
echo "[env.production]" >> wrangler.toml
# echo "route = 'flotiq.com/blog/*'" >> wrangler.toml
# echo "routes = [{ pattern = 'blog.flotiq.com', custom_domain = true }]" >> wrangler.toml
mkdir -p /home/runner/.wrangler/config/
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml
cat wrangler.toml
cp worker-index.js workers-site/index.js
wrangler publish --env=production
# Refresh sitemap in Google and Bing
curl "https://www.google.com/webmasters/sitemaps/ping?sitemap=https://blog.flotiq.com/sitemap/sitemap-index.xml"
curl "https://www.bing.com/webmaster/ping.aspx?siteMap=https://blog.flotiq.com/sitemap/sitemap-index.xml"
shell: bash
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
ZONE_ID: ${{ secrets.ZONE_ID }}
9 changes: 9 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "flotiq-blog"
main = "worker-index.js"
compatibility_date = "2024-01-09"

[site]
bucket = "./public"

[env.production]
name = "flotiq-blog-production"

0 comments on commit 564edd0

Please sign in to comment.