Deploy Branch #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |