-
-
Notifications
You must be signed in to change notification settings - Fork 5
50 lines (49 loc) · 1.51 KB
/
Copy pathauto_deploy.yml
File metadata and controls
50 lines (49 loc) · 1.51 KB
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
43
44
45
46
47
48
49
50
name: deploy
on:
push:
branches: ["main"]
paths:
- "frontend/**"
- ".github/workflows/auto_deploy.yml"
env:
VITE_APP_BACKEND_ROOT_ENDPOINT: ${{ vars.VITE_APP_BACKEND_ROOT_ENDPOINT }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.26
- name: setup git auth
run: |
git config --global credential.helper store
echo "https://${{ secrets.ACCESS_TOKEN }}:x-oauth-basic@github.com" > ~/.git-credentials
git config --global user.name $user_name
git config --global user.email $user_email
env:
user_name: "ArielMAJ"
user_email: "ariel.maj@hotmail.comm"
- name: deploy to gh-pages
run: |
cd frontend
bun install
mkdir tmp
cd tmp
git init
git remote add origin "https://github.com/${{ github.repository }}.git"
git fetch origin gh-pages
git checkout gh-pages
find . -maxdepth 1 -type f ! -name "CNAME" -exec rm -v {} \;
find . -maxdepth 1 -type d ! -name ".git" -exec rm -rv {} \;
cd ..
bun run build
mv dist/* tmp
cd tmp
if [[ ! $(git status --porcelain) ]]; then
echo "No changes to commit. Skipping deployment."
exit 0
fi
git add -A
git commit -m "🚀 Deploy id ${GITHUB_RUN_ID}"
git push origin gh-pages