-
Notifications
You must be signed in to change notification settings - Fork 7
42 lines (39 loc) · 1.24 KB
/
build-and-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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: '20.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.mts' # 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}}