Merge pull request #189 from yvtr/patch-1 #84
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: Build and Deploy Staging Branch | |
on: | |
push: | |
branches: [ staging ] | |
paths-ignore: | |
- 'ios/**' | |
- 'android/**' | |
- '.vscode/**' | |
- '**.md' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
path: 'build' | |
# https://github.com/actions/checkout#push-a-commit-using-the-built-in-token | |
- name: Set GitHub Actions as Commit Author | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email github-actions@github.com | |
- name: Build | |
run: | | |
cd build | |
echo "VITE_BASE_URL=/acchymns-dev/" > .env # We deploy to github.io/acchyms-dev, which we serve on the root | |
npm i | |
npm run deploy-check | |
npm run build | |
npx cap copy web # This runs our helper script to compress the song book info | |
cd .. | |
- name: Checkout Dev Target | |
uses: actions/checkout@v4 | |
with: | |
repository: ACC-Hymns/acchymns-dev | |
path: 'deploy' | |
token: ${{ secrets.DEPLOYMENT_PAT }} | |
- name: Push files to target | |
run: | | |
rm -r deploy/* | |
mv build/dist/* deploy | |
cp deploy/index.html deploy/404.html # This is to avoid 404 errors on reload (Ugly fix but okay I guess) | |
cd deploy | |
touch .nojekyll | |
git add . | |
git commit -m $GITHUB_SHA | |
git push |