my-phonebook_v2.0.4 #13
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: Deploy to Production Environment | |
# 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] | |
jobs: | |
lint-client: | |
name: Lint and Export client | |
runs-on: ubuntu-latest | |
env: | |
NEXT_PUBLIC_BASE_PATH: ${{ secrets.NEXT_PUBLIC_BASE_PATH }} | |
NEXT_PUBLIC_BASE_API_URL: ${{ secrets.NEXT_PUBLIC_BASE_API_URL_PROD }} | |
BASE_API_URL: ${{ secrets.BASE_API_URL }} | |
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 }} | |
NEXT_PUBLIC_FIREBASE_WEB_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_WEB_MESSAGING_SENDER_ID_PROD }} | |
NEXT_PUBLIC_FIREBASE_WEB_APP_ID: ${{ secrets.FIREBASE_WEB_APP_ID_PROD }} | |
NEXT_PUBLIC_FIREBASE_WEB_MEASUREMENT_ID: ${{ secrets.FIREBASE_WEB_MEASUREMENT_ID_PROD }} | |
NEXT_PUBLIC_MEDIA_BG1: ${{ secrets.NEXT_PUBLIC_MEDIA_BG1 }} | |
NEXT_PUBLIC_RANDOM_JOKE_API: ${{ secrets.NEXT_PUBLIC_RANDOM_JOKE_API }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Use NodeJS v18.14.2 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.14.2 | |
- name: Install Dependencies | |
run: | | |
cd client | |
npm install | |
- name: Lint Client | |
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: | | |
cd client | |
touch out/.nojekyll | |
- name: Archive Development Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: main-out | |
path: client/out | |
retention-days: 3 | |
lint-server: | |
name: Lint Server | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Use NodeJS v18.14.2 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.14.2 | |
- name: Install Dependencies and lint | |
run: | | |
cd server | |
npm install | |
npm run lint | |
deploy-client: | |
name: Deploy client to Github Pages | |
needs: lint-client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
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: ./ | |
publish_branch: gh-pages | |
deploy-server: | |
name: Deploy Server to Vercel | |
needs: lint-server | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_PROD }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_PROD }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Use NodeJS v18.14.2 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.14.2 | |
- name: Install Vercel CLI | |
run: npm install --global [email protected] | |
- name: Pull Vercel Environment Information | |
run: | | |
cd server | |
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
run: | | |
cd server | |
npm install | |
npm run docs:vercel | |
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy Project Artifacts to Vercel | |
run: | | |
cd server | |
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Post Deployment Clean-up | |
run: | | |
cd server | |
rm -r -f .vercel |