Skip to content

refactor: move gtag script right after <head> #185

refactor: move gtag script right after <head>

refactor: move gtag script right after <head> #185

name: Build and eventually deploy
on:
push:
branches:
- '*'
env:
TARGET_DIR: dist/analog/public
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Set environment variable based on branch
run: |
if [[ $GITHUB_REF == refs/heads/main || $GITHUB_REF == refs/heads/master ]]; then
echo "Branch is main or master. Setting DRY_RUN to empty."
echo "DRY_RUN=" >> $GITHUB_ENV
else
echo "Branch is not main or master. Setting DRY_RUN to '--dry-run'."
echo "DRY_RUN=--dry-run" >> $GITHUB_ENV
fi
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: 'UA-XXXXXXXXX-1'
replace: ${{ secrets.G_TAG_CODE }}
include: 'vite.config.ts' # Replace google Tag
- uses: k9n-dev/[email protected]
with:
access-token: ${{ secrets.ACCESS_TOKEN }}
install-args: '--legacy-peer-deps'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: public dir
path: ${{env.TARGET_DIR}}