From a5d4cee49bb4cbef73329d0e00ac349cbd964126 Mon Sep 17 00:00:00 2001 From: Maciej Niemcewicz Date: Wed, 10 Jan 2024 10:59:01 +0100 Subject: [PATCH 1/3] deployment with wrangler action --- .github/workflows/ci.yml | 28 ++++++++-------------------- wrangler.toml | 5 +++++ 2 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 wrangler.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bed40a4..b6f90e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} + \ No newline at end of file diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 0000000..649c6b8 --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,5 @@ +name = "flotiq-blog" +main = "index.js" +compatibility_date = "2024-01-09" +[env.production] +bucket = "public/" \ No newline at end of file From 8aff183c02e625310f8b4a082432246f595ac1ef Mon Sep 17 00:00:00 2001 From: Maciej Niemcewicz Date: Wed, 10 Jan 2024 11:23:08 +0100 Subject: [PATCH 2/3] fix entrypoint --- wrangler.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrangler.toml b/wrangler.toml index 649c6b8..7f7ab0b 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,5 +1,5 @@ name = "flotiq-blog" -main = "index.js" +main = "worker-index.js" compatibility_date = "2024-01-09" [env.production] bucket = "public/" \ No newline at end of file From 68645a0fd5c294fa3fda1e6ad235285221b92394 Mon Sep 17 00:00:00 2001 From: Maciej Niemcewicz Date: Wed, 10 Jan 2024 11:34:53 +0100 Subject: [PATCH 3/3] fix wrangler.toml --- wrangler.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wrangler.toml b/wrangler.toml index 7f7ab0b..c0dee21 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,5 +1,9 @@ name = "flotiq-blog" main = "worker-index.js" compatibility_date = "2024-01-09" + +[site] +bucket = "./public" + [env.production] -bucket = "public/" \ No newline at end of file +name = "flotiq-blog-production" \ No newline at end of file