fix: improve filtering #23
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: Epitome CI/CD | |
on: | |
push: | |
branches: | |
- master | |
- test/gh-actions | |
jobs: | |
deploy: | |
name: Deploy to Raspberry Pi 4 (self-hosted) 🦖 | |
env: | |
TOKEN: ${{ secrets.TOKEN }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} | |
FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }} | |
FIREBASE_DATABASE_URL: ${{ secrets.FIREBASE_DATABASE_URL }} | |
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | |
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }} | |
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }} | |
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }} | |
FIREBASE_MEASUREMENT_ID: ${{ secrets.FIREBASE_MEASUREMENT_ID }} | |
runs-on: self-hosted | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Check out yarn cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: yarn | |
- name: Install npm dependencies with yarn if needed | |
run: yarn install --from-lock-file | |
- name: Build epitome (/dist) | |
run: yarn run build | |
- name: Stop previous epitome pm2 process | |
run: pm2 delete epitome 2> /dev/null || true | |
- name: Prepare application directory | |
run: rm -rf ~/apps/epitome && mkdir ~/apps/epitome | |
- name: Move build contents & dependencies to application directory | |
run: mv dist/* ~/apps/epitome && mv node_modules ~/apps/epitome | |
- name: Export Dicord token and client id as environment variables | |
run: export TOKEN=$TOKEN && export CLIENT_ID=$CLIENT_ID | |
- name: Export Firebase token and project environment variables | |
run: | | |
export FIREBASE_API_KEY=$FIREBASE_API_KEY | |
export FIREBASE_AUTH_DOMAIN=$FIREBASE_AUTH_DOMAIN | |
export FIREBASE_DATABASE_URL=$FIREBASE_DATABASE_URL | |
export FIREBASE_PROJECT_ID=$FIREBASE_PROJECT_ID | |
export FIREBASE_STORAGE_BUCKET=$FIREBASE_STORAGE_BUCKET | |
export FIREBASE_MESSAGING_SENDER_ID=$FIREBASE_MESSAGING_SENDER_ID | |
export FIREBASE_APP_ID=$FIREBASE_APP_ID | |
export FIREBASE_MEASUREMENT_ID=$FIREBASE_MEASUREMENT_ID | |
- name: Start new epitome pm2 process | |
run: cd ~/apps/epitome && pm2 start -f index.js --name epitome && pm2 save |