-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,22 +6,21 @@ name: firebase functions deploy - prod server | |
on: | ||
# Triggers the workflow on push or pull request events but only for the develop branch | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Setting Slack API | ||
run: | | ||
touch deployMessageToSlack.sh | ||
echo 'curl -X POST -H 'Content-type: application/json' --data "{\"text\":\" [DEPLOY] [HAVIT_SERVER] deployment successful.\", \"icon_emoji\": \":ghost:\"}" ${{ secrets.PROD_WEB_HOOK_ERROR_MONITORING }}' >> deployMessageToSlack.sh | ||
chmod 755 deployMessageToSlack.sh | ||
touch deployMessageToSlack.sh | ||
echo 'curl -X POST -H 'Content-type: application/json' --data "{\"text\":\" [DEPLOY] [HAVIT_SERVER] deployment successful.\", \"icon_emoji\": \":ghost:\"}" ${{ secrets.PROD_WEB_HOOK_ERROR_MONITORING }}' >> deployMessageToSlack.sh | ||
chmod 755 deployMessageToSlack.sh | ||
- name: create env file | ||
run: | | ||
cd functions | ||
|
@@ -59,36 +58,36 @@ jobs: | |
cd functions | ||
touch ${{ secrets.APPLE_PRIVATE_KEY_FILE }} | ||
echo "${{ secrets.APPLE_PRIVATE_KEY }}" > ${{ secrets.APPLE_PRIVATE_KEY_FILE }} | ||
- name: create-json | ||
id: create-json | ||
id: create-dev-json | ||
uses: jsdaniell/[email protected] | ||
with: | ||
name: "havit-wesopt29-firebase-adminsdk-mgljp-478046b091.json" | ||
json: ${{ secrets.FIREBASE_JSON }} | ||
dir: 'functions/' | ||
dir: "functions/" | ||
|
||
- name: create-json | ||
id: create-prod-json | ||
uses: jsdaniell/[email protected] | ||
with: | ||
name: "havit-production-firebase-adminsdk-bypl1-d081cc62e4.json" | ||
json: ${{ secrets.PROD_FIREBASE_JSON }} | ||
dir: 'functions/' | ||
dir: "functions/" | ||
|
||
- name: Install npm pacakges | ||
run: | | ||
cd functions | ||
npm install | ||
npm install -g firebase-tools | ||
npm install --save-dev cross-env | ||
- name: Deploy to Firebase | ||
run: | | ||
cd functions | ||
firebase use prod | ||
npm run deploy | ||
env: | ||
firebase use prod --token ${{ secrets.PROD_FIREBASE_TOKEN }} | ||
npm run deploy --token ${{ secrets.PROD_FIREBASE_TOKEN }} | ||
env: | ||
FIREBASE_TOKEN: ${{ secrets.PROD_FIREBASE_TOKEN }} | ||
|
||
- name: action-slack | ||
|
@@ -99,4 +98,4 @@ jobs: | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.PROD_SLACK_BUILD_WEBHOOK_URL }} # required | ||
if: always() # Pick up events even if the job fails or is canceled. | ||
if: always() # Pick up events even if the job fails or is canceled. |