gsites-components_v4.1.0 #55
Workflow file for this run
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: Prduction - Deploy to GitHub Pages | |
# This workflow will trigger on any tag/release created on *any* branch | |
# Make sure to create tags/releases only from the "master" branch for consistency | |
on: | |
release: | |
types: [published] | |
env: | |
FIREBASE_TARGET: 'prod' | |
jobs: | |
lint-export-client: | |
name: Lint and Export client | |
if: github.event.release.target_commitish == 'master' | |
runs-on: ubuntu-latest | |
env: | |
NEXT_PUBLIC_BASE_PATH: ${{ secrets.NEXT_PUBLIC_BASE_PATH }} | |
NEXT_PUBLIC_FIREBASE_WEB_API_KEY: ${{ secrets.FIREBASE_WEB_API_KEY_PROD }} | |
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN: ${{ secrets.FIREBASE_WEB_AUTHDOMAIN_PROD }} | |
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID: ${{ secrets.FIREBASE_WEB_PROJECT_ID_PROD }} | |
NEXT_PUBLIC_FIREBASE_WEB_STORAGE_BUCKET: ${{ secrets.FIREBASE_WEB_STORAGE_BUCKET_PROD }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Build Firebase Settings | |
run: chmod u+x scripts/build.sh && ./scripts/build.sh | |
- name: Use NodeJS v16.14.2 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.2 | |
- name: Install Dependencies and lint | |
run: | | |
cd client | |
npm install | |
- name: Lint | |
run: | | |
cd client | |
npm run lint | |
- name: Export static files | |
run: | | |
cd client | |
npm run export | |
mv out/404/index.html out/404.html | |
- name: Disable Jekyll | |
run: touch client/out/.nojekyll | |
- name: Archive Development Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: main-out | |
include-hidden-files: true | |
path: | | |
client/out | |
client/firebase.json | |
client/.firebaserc | |
client/firestore.rules | |
client/firestore.indexes.json | |
client/storage.rules | |
retention-days: 3 | |
# Deploy Firebase: Firestore/Storage Rules and Indexes | |
deploy-firebase: | |
name: Deploy Firebase Settings | |
if: github.event.release.target_commitish == 'master' | |
needs: lint-export-client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: main-out | |
- name: Deploy to Firebase | |
uses: w9jds/firebase-action@master | |
with: | |
args: > | |
use $FIREBASE_TARGET && | |
firebase deploy --only firestore:rules,firestore:indexes,storage | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
deploy-client: | |
name: Deploy Client to Github Pages | |
if: github.event.release.target_commitish == 'master' | |
needs: lint-export-client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: main-out | |
- name: List files for publish | |
run: ls -l -a | |
- name: Deploy to Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./out | |
publish_branch: gh-pages |