-
Notifications
You must be signed in to change notification settings - Fork 3
44 lines (41 loc) · 1.13 KB
/
copyDeploy.yaml
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
name: Copy to deploy branch
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Copy files from main to deploy branch
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git checkout -b deploy
git rm -rf .
git checkout main -- .
- name: Install dependencies and build
run: |
git checkout deploy
npm install
npm run build
- name: Remove files and folders except dist
run: |
git checkout deploy
rm -r $(ls -A | grep -v dist | grep -v .git)
- name: Move files from dist to root
run: |
git checkout deploy
mv dist/* .
rm -rf dist
- name: Commit and push changes
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git add .
git commit -m "Push build files to deploy branch"
git push origin deploy -f