firebase-users-admin_v1.1.6 #21
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 Build client | |
if: github.event.release.target_commitish == 'master' | |
runs-on: ubuntu-latest | |
env: | |
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} | |
REACT_APP_FIREBASE_API_KEY: ${{ secrets.REACT_APP_FIREBASE_API_KEY }} | |
REACT_APP_FIREBASE_AUTHDOMAIN: ${{ secrets.REACT_APP_FIREBASE_AUTHDOMAIN }} | |
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }} | |
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.REACT_APP_FIREBASE_STORAGE_BUCKET }} | |
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }} | |
REACT_APP_FIREBASE_APP_ID: ${{ secrets.REACT_APP_FIREBASE_APP_ID }} | |
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.REACT_APP_FIREBASE_MEASUREMENT_ID }} | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Use NodeJS ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies and lint | |
run: | | |
cd client | |
npm install | |
npm run lint | |
- name: Build client | |
run: | | |
cd client | |
npm run build | |
- name: Archive Development Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
include-hidden-files: true | |
path: | | |
client/build | |
client/.firebaserc | |
client/firebase.json | |
retention-days: 3 | |
lint-server: | |
name: Lint Server | |
if: github.event.release.target_commitish == 'master' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Use NodeJS ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies and lint | |
run: | | |
cd server | |
npm install | |
npm run lint | |
deploy-client: | |
name: Deploy Client to Firebase Hosting | |
if: github.event.release.target_commitish == 'master' | |
needs: lint-client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build | |
- name: Deploy to Firebase | |
uses: w9jds/firebase-action@master | |
with: | |
args: deploy --only hosting:master | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
deploy-server: | |
if: ${{ vars.IS_DEPLOY_SERVER == 'heroku' }} | |
name: Deploy Server to Heroku | |
needs: lint-server | |
runs-on: ubuntu-latest | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }} | |
HEROKU_APP: ${{ secrets.HEROKU_APP }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- run: | | |
cat >~/.netrc <<EOF | |
machine api.heroku.com | |
login $HEROKU_EMAIL | |
password $HEROKU_API_KEY | |
machine git.heroku.com | |
login $HEROKU_EMAIL | |
password $HEROKU_API_KEY | |
EOF | |
- run: heroku git:remote -a $HEROKU_APP | |
- run: git push heroku HEAD:refs/heads/master | |
- run: rm -r -f .netrc | |
# Push the complete "app" Docker image | |
docker-build-push: | |
name: Deploy App to Docker Hub | |
if: github.event.release.target_commitish == 'master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Create temporary env variables | |
# Replace these files with actual values during | |
# runtime on 'docker-compose up' | |
run: | | |
cp client/.env.example client/.env | |
cp server/.env.example server/.env | |
- name: Set release version number | |
run: sed -i -e "s/latest/${{ github.event.release.tag_name }}/g" docker-compose.app.yml | |
- name: Build Images | |
run: docker compose -f docker-compose.app.yml build | |
- name: Push Images to Docker Hub | |
run: docker compose -f docker-compose.app.yml push | |
# Push the development (client/server) Docker images | |
docker-build-push-dev: | |
name: Deploy Development to Docker Hub | |
if: github.event.release.target_commitish == 'master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Create temporary env variables | |
run: | | |
cp client/.env.example client/.env | |
cp server/.env.example server/.env | |
- name: Build Images | |
run: docker compose -f docker-compose.dev.yml build | |
- name: Push Images to Docker Hub | |
run: docker compose -f docker-compose.dev.yml push |