-
Notifications
You must be signed in to change notification settings - Fork 24
57 lines (48 loc) · 1.79 KB
/
deploy-branch.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
name: Deploy Branch
on:
workflow_dispatch:
jobs:
build_branch:
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4.0.2
with:
node-version: '20.x'
- name: Install npm packages
run: |
set -e
npm install
- name: Build UI
run: |
set -e
npm run build:production
- name: Deploy
uses: peaceiris/actions-gh-pages@v4.0.0
with:
personal_token: ${{ secrets.GH_PAGES_DEPLOY }}
force_orphan: true
publish_branch: gh-pages-${{ github.ref_name }}
publish_dir: ./dist
combined_deploy:
runs-on: ubuntu-latest
needs: build_branch
concurrency: combined_deploy
steps:
- name: Deploy branches
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git clone -b gh-pages-main -q "https://github.com/wooferzfg/tww-rando-tracker" ./repo
rm -rf ./repo/${{ github.ref_name }}
git clone -b gh-pages-${{ github.ref_name }} -q "https://github.com/wooferzfg/tww-rando-tracker" ./repo/${{ github.ref_name }}
rm -r ./repo/${{ github.ref_name }}/.git
cd repo
git checkout --orphan gh-pages-temp
git add ${{ github.ref_name }}/
git add .
git commit -m "Deploy main branch and ${{ github.ref_name }} branch together"
git push --force https://action:${{ secrets.GH_PAGES_DEPLOY }}@github.com/wooferzfg/tww-rando-tracker.git gh-pages-temp:gh-pages-main
git push https://action:${{ secrets.GH_PAGES_DEPLOY }}@github.com/wooferzfg/tww-rando-tracker.git :gh-pages-${{ github.ref_name }}