fix: build issues #2
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: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
TURBO_REMOTE_ONLY: true | |
NODE_VERSION: "18" | |
jobs: | |
build-and-deploy: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "${{ env.NODE_VERSION }}" | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Create google service account file and env var | |
run: | | |
# decode the token into json and write to file, using base64 to not have to mess with the json format | |
echo "Creating file in $HOME/firebase.json" | |
echo "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON_BASE64 }}" | base64 --decode > "$HOME/firebase.json" | |
# source the env with the path to the file | |
echo "Sourcing env GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase.json" | |
echo "GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase.json" >> $GITHUB_ENV | |
- name: Install | |
run: npm ci | |
- name: Build projects | |
run: npm run build | |
- name: Deploy to firebase | |
run: npm run deploy |