Skip to content

feat: set up new workflow #2

feat: set up new workflow

feat: set up new workflow #2

Workflow file for this run

name: Ce Spun Studentii Pipeline
on:
push:
branches:
- master
- 'release/*'
pull_request:
types:
- closed
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '17'
- name: Install dependencies
run: npm install
- name: Build the app
run: npm run build
- name: Determine Branch Name
id: branch_name
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
- name: Set Firebase Project ID and Token
id: set_firebase_vars
run: |
if [[ "${{ steps.branch_name.outputs.branch }}" == "master" ]]; then
echo "Setting Firebase for master branch"
echo "::set-output name=FIREBASE_TOKEN::${{ secrets.FIREBASE_TOKEN }}"
echo "::set-output name=FIREBASE_PROJECT_ID::${{ secrets.FIREBASE_PROJECT_ID }}"
elif [[ "${{ steps.branch_name.outputs.branch }}" =~ ^release/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Setting Firebase for release branch"
echo "::set-output name=FIREBASE_TOKEN::${{ secrets.TESTING_FIREBASE_TOKEN }}"
echo "::set-output name=FIREBASE_PROJECT_ID::${{ secrets.TESTING_FIREBASE_PROJECT_ID }}"
else
echo "Branch not recognized, skipping deployment."
echo "::set-output name=SKIP_DEPLOYMENT::true"
fi
shell: bash
- name: Deploy to Firebase
if: steps.set_firebase_vars.outputs.SKIP_DEPLOYMENT != 'true'
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting --project ${{ steps.set_firebase_vars.outputs.FIREBASE_PROJECT_ID }}
env:
FIREBASE_TOKEN: ${{ steps.set_firebase_vars.outputs.FIREBASE_TOKEN }}