-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
517c825
commit 638b09b
Showing
5 changed files
with
52 additions
and
193 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Android - Release to Google Play | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
android_release: | ||
uses: IDEMSInternational/parenting-app-ui/.github/workflows/reusable-android-release.yml@master | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Perform content sync and create a PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr-title: | ||
description: Title for PR | ||
type: string | ||
default: sync content from google sheets | ||
pr-body: | ||
description: Description for PR | ||
type: string | ||
default: Automated PR creation from actions | ||
jobs: | ||
sync_content: | ||
uses: IDEMSInternational/parenting-app-ui/.github/workflows/reusable-content-sync.yml@master | ||
with: | ||
pr-title: ${{ inputs.pr-title }} | ||
pr-body: ${{ inputs.pr-body }} | ||
secrets: inherit |
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 |
---|---|---|
@@ -1,123 +1,15 @@ | ||
# IDEMS Template Metadata | ||
%TAG !idems_meta! id:deploy_firebase,version:1.0.0 | ||
--- | ||
################################################################################## | ||
# About | ||
################################################################################## | ||
# Build and deploy app to firebase | ||
# Supports deploying to custom hosting channel for long-lived preview urls (30d) | ||
# Or using custom hosting target | ||
|
||
################################################################################## | ||
# Configuration (updated per deployment) | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Deploy - Firebase | ||
|
||
env: | ||
FIREBASE_PROJECT_ID: "plh-teens-app1" # | ID of firebase project used (in case of multiple deployment targets just specify default) | ||
FIREBASE_HOSTING_CHANNEL: "live" # | Name of channel to deploy to (default 'live' is main site, any other word, e.g. 'pr' will create random temp preview site) | ||
FIREBASE_HOSTING_TARGET: "idems-debug" # | Optional override if using multiple hosting target sites (default target project ID) | ||
FIREBASE_SERVICE_ACCOUNT: ${{secrets.FIREBASE_SERVICE_ACCOUNT}} # | JSON export of firebase service account (from console) | ||
################################################################################## | ||
# Triggers | ||
# Specify conditions to run workflow. # See more information at: | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows | ||
################################################################################## | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
################################################################################## | ||
# Main Code | ||
################################################################################## | ||
name: Deploy - Firebase | ||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
concurrency: | ||
group: "deploy_firebase" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_action: | ||
uses: ./.github/workflows/app-build.yml | ||
with: | ||
artifact-name: www | ||
web_preview: | ||
uses: IDEMSInternational/parenting-app-ui/.github/workflows/reusable-deploy-web-preview.yml@master | ||
secrets: inherit | ||
|
||
deploy: | ||
needs: build_action | ||
runs-on: ubuntu-latest | ||
outputs: | ||
urls: ${{ steps.deploy.outputs.urls }} | ||
steps: | ||
# Extract build artifact | ||
- uses: actions/checkout@v3 | ||
- name: Download Build Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: www | ||
- name: Extract Build folder | ||
run: | | ||
mkdir www | ||
tar -xf artifact.tar --directory www | ||
# Ensure FIREBASE_HOSTING_TARGET set (default fallback to projectId) | ||
- name: Populate Env | ||
if: ${{env.FIREBASE_HOSTING_TARGET == ''}} | ||
run: echo "FIREBASE_HOSTING_TARGET=${{env.FIREBASE_PROJECT_ID}}" >> "$GITHUB_ENV" | ||
|
||
# Create a .firebaserc file mapping any firebase deployment host targets (required if multi-host projects) | ||
# e.g. {"projects": {"default": "my_app"},"targets": {"my_app": {"hosting": {"my_app_dev":["my_app_dev"]} } } | ||
- name: Populate Firebase Targets | ||
run: | | ||
FIREBASE_RC_TARGETS=$(jq -n \ | ||
--argjson "${{env.FIREBASE_PROJECT_ID}}" \ | ||
'{"hosting":{"${{env.FIREBASE_HOSTING_TARGET}}":["${{env.FIREBASE_HOSTING_TARGET}}"]}}' \ | ||
'$ARGS.named' | ||
) | ||
FIREBASE_RC=$(jq -n \ | ||
--argjson projects '{"default":"${{env.FIREBASE_PROJECT_ID}}"}' \ | ||
--argjson targets "$FIREBASE_RC_TARGETS" \ | ||
'$ARGS.named' | ||
) | ||
echo $FIREBASE_RC | jq '.' | ||
echo $FIREBASE_RC > .firebaserc | ||
# Create a firebase.json file to handle single-page-app hosting redirects | ||
# e.g. {"hosting": [{"target": "app","public": "www","ignore": ["firebase.json"], "rewrites": [{"source": "**","destination": "/index.html"}] }]} | ||
- name: Populate Firebase JSON | ||
run: | | ||
FIREBASE_JSON_HOSTING=$(jq -n \ | ||
--arg target "${{ env.FIREBASE_HOSTING_TARGET }}" \ | ||
--arg public "www" \ | ||
--argjson ignore '["firebase.json"]' \ | ||
--argjson rewrites '[{"source": "**","destination": "/index.html"}]' \ | ||
'$ARGS.named' | ||
) | ||
FIREBASE_JSON=$(jq -n \ | ||
--argjson hosting "[$FIREBASE_JSON_HOSTING]" \ | ||
'$ARGS.named' | ||
) | ||
echo $FIREBASE_JSON | jq '.' | ||
echo $FIREBASE_JSON > firebase.json | ||
# Deploy to firebase | ||
- id: deploy | ||
uses: FirebaseExtended/action-hosting-deploy@v0 | ||
with: | ||
repoToken: "${{ secrets.GITHUB_TOKEN }}" | ||
firebaseServiceAccount: "${{ env.FIREBASE_SERVICE_ACCOUNT }}" | ||
projectId: "${{ env.FIREBASE_PROJECT_ID }}" | ||
channelId: "${{ env.FIREBASE_HOSTING_CHANNEL }}" | ||
target: "${{ env.FIREBASE_HOSTING_TARGET }}" | ||
expires: "30d" | ||
################################################################################## | ||
# Useful Links | ||
################################################################################## | ||
# https://firebase.google.com/docs/hosting/full-config | ||
# https://firebase.google.com/docs/cli/targets | ||
|
||
# https://www.baeldung.com/linux/jq-command-json | ||
# https://jqlang.github.io/jq/manual/ | ||
# https://jqplay.org/ | ||
|
||
# echo $FIREBASE_JSON | jq '.hosting[0]' |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Deployment Preview | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, synchronize] | ||
|
||
jobs: | ||
pr_preview: | ||
uses: IDEMSInternational/parenting-app-ui/.github/workflows/reusable-deploy-pr-preview.yml@master | ||
secrets: inherit |