-
Notifications
You must be signed in to change notification settings - Fork 0
24 lines (20 loc) · 768 Bytes
/
deploy.yml
File metadata and controls
24 lines (20 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
name: Deploy GitHub Pages with Analytics
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Inject Google Analytics
run: |
GA_SCRIPT="<script async src='https://www.googletagmanager.com/gtag/js?id=${{ secrets.GA_TRACKING_ID }}'></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${{ secrets.GA_TRACKING_ID }}');</script>"
sed -i "s#</head>#${GA_SCRIPT}</head>#g" index.html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./