forked from mazipan/baca-quran.id
-
Notifications
You must be signed in to change notification settings - Fork 4
113 lines (94 loc) · 3.49 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Deploy to GitHub Pages
on:
workflow_dispatch:
push:
branches: 'master'
permissions:
contents: write
jobs:
build_site:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
pull-requests: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.PERSONAL_TOKEN }}
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build project
env:
PUBLIC_FIREBASE_API_KEY: ${{ secrets.PUBLIC_FIREBASE_API_KEY }}
PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.PUBLIC_FIREBASE_AUTH_DOMAIN }}
PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.PUBLIC_FIREBASE_PROJECT_ID }}
PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.PUBLIC_FIREBASE_STORAGE_BUCKET }}
PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
PUBLIC_FIREBASE_APP_ID: ${{ secrets.PUBLIC_FIREBASE_APP_ID }}
PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.PUBLIC_FIREBASE_MEASUREMENT_ID }}
run: |
pnpm run build
touch build/.nojekyll
- name: Fix permissions
run: |
chmod -c -R +rX "build/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
- name: Force push gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build
clean: true
branch: gh-pages
token: ${{ secrets.PERSONAL_TOKEN }}
- name: Commit generated files only
run: |
echo "> Start remove unused files..."
rm -rf .github/workflows .svelte-kit markdowns screenshoot scripts static src node_modules
rm -rf .all-contributorsrc .editorconfig .eslintignore .eslintrc.cjs .gitignore .kodiak.toml .npmrc .prettierignore .prettierrc package.json pnpm-lock.yaml postcss.config.js svelte.config.js tailwind.config.js tsconfig.json vite.config.ts
echo "> Copy build directory..."
cp -r build/. ./
rm -rf build
echo "> Set git config..."
git config --local user.email "[email protected]"
git config --local user.name "Irfan Maulana"
echo "> Add and commit files..."
git add -A
git commit -m "[CI]: Auto Deploy 🚀"
echo "> Finish commit changes to repo"
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: mazipan-quran-offline/mazipan-quran-offline.github.io
force: true
github_token: ${{ secrets.PERSONAL_TOKEN }}
branch: master
directory: build