-
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (80 loc) · 2.51 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
name: Deploy to GitHub Pages
on:
push:
branches:
- main # Adjust the branch name as per your project setup
paths:
- '.github/workflows/deploy.yml'
tags:
- "*"
- "**"
workflow_dispatch:
env:
VITE_BASE_URL_PROD: 'https://aichatsback.up.railway.app'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Get npm cache
id: npm-cache
run: echo "NPM_CACHE_DIR=$(pwd)/node_modules" >> "${GITHUB_OUTPUT}"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache.outputs.NPM_CACHE_DIR }}
key:
npm-${{github.workflow}}-${{ runner.os }}-${{
hashFiles('**package.json') }}
restore-keys: |
npm-${{github.workflow}}-${{ runner.os }}-${{ hashFiles('**package.json') }}
- name: Install dependencies
run: npm install --include=dev
- name: Get working directory
id: wkdir
run: | #use it later
echo "wkdir=$(pwd)" >> $GITHUB_OUTPUT
- name: Build
run: |
npm run build
- name: Fix Build
run: |
sed -i 's/\/assets/.\/assets/g' ./build/index.html
echo "fixed build"
# - name: Deploy
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "Hiro"
# npm run gh
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v1
# with:
# # Upload entire repository
# path: './build'
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ github.workspace }}/build
# cname: github.com/aichats/aichats.app
publish_branch: gh-pages
commit_message: ${{ github.event.head_commit.message }}
full_commit_message: ${{ github.event.head_commit.message }}
allow_empty_commit: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'