Deploy Branch #37
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@v3 | |
- name: Install Node | |
uses: actions/setup-node@v3.8.1 | |
with: | |
node-version: '18.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@v3.9.3 | |
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 | |
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 }} |