Update build script #7
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
# .github/workflows/deploy.yml | |
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup Node | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
cd blog-apps | |
npm ci | |
# Create .env file | |
- name: Create .env file | |
run: | | |
echo "FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }}" >> .env | |
echo "FIREBASE_AUTH_DOMAIN=${{ vars.FIREBASE_AUTH_DOMAIN }}" >> .env | |
echo "FIREBASE_PROJECT_ID=${{ vars.FIREBASE_PROJECT_ID }}" >> .env | |
echo "FIREBASE_STORAGE_BUCKET=${{ vars.FIREBASE_STORAGE_BUCKET }}" >> .env | |
echo "FIREBASE_MESSAGING_SENDER_ID=${{ vars.FIREBASE_MESSAGING_SENDER_ID }}" >> .env | |
echo "FIREBASE_APP_ID=${{ vars.FIREBASE_APP_ID }}" >> .env | |
# Build the project | |
- name: Build | |
run: npm run build | |
# Deploy to GitHub Pages | |
- name: Deploy | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
git checkout --orphan gh-pages | |
git reset --hard | |
git add -f dist/blog-app/browser | |
git mv dist/blog-app/browser/* . | |
git add . | |
git commit -m "Deploy to GitHub Pages" | |
git push origin gh-pages --force |