-
Notifications
You must be signed in to change notification settings - Fork 5
58 lines (49 loc) · 1.87 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 }}