From cfe38c6413f6bb6e28bacf9a72d9fe2aad0b90a3 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sat, 12 Aug 2023 13:16:49 -0700 Subject: [PATCH] Fix prod deployment cache issue and analytics templating --- .github/workflows/ci.yml | 11 +++++++++-- .github/workflows/deploy.yml | 9 +++++++++ frontend/index.html | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e8776c8..a353e50d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: - master env: CARGO_TERM_COLOR: always + INDEX_HTML_HEAD_REPLACEMENT: jobs: build: @@ -44,6 +45,12 @@ jobs: rustup update stable rustc --version + - name: Replace template in of index.html + run: | + # Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys) + git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT="" + sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html + - name: 🌐 Build Graphite web code env: NODE_ENV: production @@ -58,8 +65,8 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: graphite-dev # e.g. 'my-project' - directory: frontend/dist # e.g. 'dist' + projectName: graphite-dev + directory: frontend/dist gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: 👕 Lint Graphite web formatting diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 12514903..89860ce2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,10 +18,14 @@ jobs: RUSTC_WRAPPER: /usr/bin/sccache CARGO_INCREMENTAL: 0 SCCACHE_DIR: /var/lib/github-actions/.cache + INDEX_HTML_HEAD_REPLACEMENT: steps: - uses: actions/checkout@v3 + - name: 🔧 Clear wasm-bindgen cache + run: rm -r ~/.cache/.wasm-pack + - name: 🔧 Set up Node uses: actions/setup-node@v3 with: @@ -38,6 +42,10 @@ jobs: rustup update stable rustc --version + - name: Replace template in of index.html + run: | + sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html + - name: 🌐 Build Graphite web code env: NODE_ENV: production @@ -53,4 +61,5 @@ jobs: accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: graphite-editor directory: frontend/dist + branch: master gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/frontend/index.html b/frontend/index.html index b77249ed..3a32ad90 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -9,7 +9,6 @@ - @@ -17,6 +16,7 @@ +