oui #73
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Remove existing prod branch (if exists) | |
run: | | |
git fetch --prune | |
git show-ref --verify --quiet refs/heads/prod && git branch -D prod || true | |
git push origin --delete prod || true | |
- name: Create prod branch from main | |
run: | | |
git checkout -b prod | |
git push -u origin prod | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20.x | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies with pnpm | |
run: pnpm install | |
- name: Build with pnpm | |
run: pnpm build | |
- name: Modify .gitignore | |
run: | | |
rm .gitignore || true | |
echo ".env" > .gitignore | |
echo "node_modules" >> .gitignore | |
rm -rf src | |
- name: Push changes to prod branch | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Garder500[Bot]" | |
git add . | |
git commit -m "Update everythings" | |
git push origin prod --force |