Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ff-prod deploys (and less code) #1580

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/actions/deploy-gfunction/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ inputs:
deploy_env:
description: env to deploy function to
required: false

checkout_path:
description: Folder with repository code
required: true

GWIP:
description: Google Workflow Identity provider
Expand Down
24 changes: 15 additions & 9 deletions .github/actions/prepare-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,33 @@ runs:
elif ${{ inputs.deploy_to == 'catalyst' }}; then
# CATALYST
echo "function_name=${{ inputs.app_base_name }}-catalyst" >> $GITHUB_OUTPUT
echo "front_url=${{ inputs.app_base_name }}-catalyst.k-f.dev" >> $GITHUB_OUTPUT
echo "front_url=app-catalyst.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=catalyst" >> $GITHUB_OUTPUT
elif ${{ contains(inputs.deploy_to, 'demo') }}; then
elif ${{ inputs.deploy_to == 'demo' }}; then
# DEMO
echo "function_name=${{ inputs.app_base_name }}-demo" >> $GITHUB_OUTPUT
echo "front_url=${{ inputs.app_base_name }}-demo.k-f.dev" >> $GITHUB_OUTPUT
echo "front_url=app-demo.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=demo" >> $GITHUB_OUTPUT
elif ${{ contains(inputs.deploy_to, 'moonbeam-alpha') }}; then
elif ${{ inputs.deploy_to == 'moonbeam-alpha' }}; then
# moonbeam-alpha
echo "function_name=${{ inputs.app_base_name }}-moonbeam-alpha" >> $GITHUB_OUTPUT
echo "front_url=${{ inputs.app_base_name }}-moonbeam-alpha.k-f.dev" >> $GITHUB_OUTPUT
echo "front_url=app-moonbeam-alpha.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=moonbeam-alpha" >> $GITHUB_OUTPUT
elif ${{ github.ref == 'refs/heads/main' }}; then
elif ${{ inputs.deploy_to == 'development' }}; then
# DEV
echo "function_name=${{ inputs.app_base_name }}-dev" >> $GITHUB_OUTPUT
echo "front_url=${{ inputs.app_base_name }}-dev.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=development" >> $GITHUB_OUTPUT
echo "front_url=app-dev.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=development" >> $GITHUB_OUTPUT
elif ${{ inputs.deploy_to == 'ff-prod' }}; then
# FF-PRODUCTION
# A build from the DEV env that points to prod
echo "function_name=${{ inputs.app_base_name }}-ff-production" >> $GITHUB_OUTPUT
echo "front_url=app-ff-production.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=production" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'pull_request' }}; then
# PR
echo "function_name=${{ inputs.app_base_name }}-pr${{ github.event.number }}" >> $GITHUB_OUTPUT
echo "front_url=${{ inputs.app_base_name }}-pr${{ github.event.number }}.k-f.dev" >> $GITHUB_OUTPUT
echo "front_url=app-pr${{ github.event.number }}.k-f.dev" >> $GITHUB_OUTPUT
echo "env_name=development" >> $GITHUB_OUTPUT
else
echo "::error title=No env to deploy::Workflow called from non-deployable branch/tag"
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/catalyst-deploy.yml

This file was deleted.

13 changes: 2 additions & 11 deletions .github/workflows/centrifuge-app.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
name: Centrifuge App
on:
push:
branches:
- main
paths:
- 'centrifuge-app/**'
- 'centrifuge-js/**'
- 'centrifuge-react/**'
- '.github/workflows/centrifuge-app.yml'
- '.github/actions/deploy-gcs'
pull_request:
paths:
- 'centrifuge-app/**'
Expand All @@ -23,7 +14,7 @@ on:
required: false
# Fancy concurrency group string to allow for multi-staging deployments
concurrency:
group: 'centrifuge-app-${{ inputs.deploy_env || github.event.inputs.deploy_env }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
group: 'centrifuge-app-${{ inputs.deploy_env || github.event.inputs.deploy_env }}@${{ github.event.name }}${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
artifact_name: "webpack${{ inputs.deploy_env && format('-{0}', inputs.deploy_env) }}"
Expand Down Expand Up @@ -103,7 +94,7 @@ jobs:
deploy-app:
concurrency:
# Do not sync the same bucket in parallel
group: deploy-${{ needs.build-app.outputs.front_url }}
group: deploy-${{ needs.build-app.outputs.front_url }}-${{ github.event.name }}
cancel-in-progress: true
permissions:
contents: 'read'
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/demo-deploys.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/deploy_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Deploy all apps"
on:
# Allow this wofkflow as a universal "deployer" to
# call from other workflows.
workflow_call:
inputs:
environment:
required: true
type: string

jobs:
app:
name: webapp
uses: ./.github/workflows/centrifuge-app.yml
secrets: inherit
with:
deploy_env: ${{ inputs.environment}}


pinning:
if: ${{ inputs.environment != 'ff-prod' }}
name: pinning
uses: ./.github/workflows/pinning-api.yml
secrets: inherit
with:
deploy_env: ${{ inputs.environment }}


onboarding:
if: ${{ inputs.environment != 'ff-prod' }}
name: onboarding
uses: ./.github/workflows/onboarding-api.yml
secrets: inherit
with:
deploy_env: ${{ inputs.environment}}

faucet:
if: ${{ inputs.environment == 'demo' || inputs.environment == 'development' }}
name: faucet
uses: ./.github/workflows/faucet-api.yml
secrets: inherit
with:
deploy_env: ${{ inputs.environment}}
19 changes: 5 additions & 14 deletions .github/workflows/faucet-api.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
name: Faucet API
on:
push:
branches:
- main
paths:
- 'faucet-api/**'
- '.github/workflows/faucet-api.yml'
- '.github/actions/deploy-gfunction'
- '.github/actions/build-function'
pull_request:
paths:
- 'faucet-api/**'
Expand All @@ -19,15 +11,11 @@ on:
deploy_env:
type: string
required: false
default: demo
env:
app_name: faucet-api
# For now deploy only on demo when triggered with workflow_call:
deploy_to: ${{ inputs.deploy_env && 'demo' || '' }}
# deploy_to: ${{ inputs_deploy_env }}
function_handler: faucet
concurrency:
group: 'faucet-api@${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
group: 'faucet-api--${{ inputs.deploy_env || github.event.inputs.deploy_env }}@${{ github.event.name }}${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a double dash faucet-api--$ here, will that cause any problems?

cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -57,6 +45,9 @@ jobs:
function_name: ${{ steps.prepare.outputs.function_name }}

deploy-faucet:
# if: ${{ inputs.deploy_env == 'demo' }} || ${{ inputs.deploy_env == 'development' }}
# For now deploy only to demo
if: ${{ inputs.deploy_env == 'demo' }}
concurrency:
group: deploy-${{ needs.build-faucet.outputs.function_name }}
cancel-in-progress: false
Expand All @@ -82,4 +73,4 @@ jobs:
target: ${{ env.function_handler }}
gcloud_region: ${{ vars.GCLOUD_REGION }}
service_account: '${{ vars.FIRESTORE_SA }}'
deploy_env: ${{ env.deploy_to }}
deploy_env: ${{ inputs.deploy_env }}
18 changes: 18 additions & 0 deletions .github/workflows/main-branch-deploys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: deploy-main
on:
push:
branches: main
pull_request:
paths:
- '.github/workflows/main-branch-deploys.yml'

jobs:
trigger:
name: deploy-${{ matrix.env }}
strategy:
matrix:
env: ['moonbeam-alpha', 'ff-prod', 'development']
uses: ./.github/workflows/deploy_all.yml
secrets: inherit
with:
environment: ${{ matrix.env }}
17 changes: 17 additions & 0 deletions .github/workflows/manual-deploys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy to Catalyst and demo
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: where to deploy
options:
- demo
- catalyst
jobs:
deploy:
name: deploy-${{ inputs.environment }}
uses: ./.github/workflows/deploy_all.yml
secrets: inherit
with:
environment: ${{ inputs.environment }}
34 changes: 0 additions & 34 deletions .github/workflows/moonbeam-alpha-deploy.yml

This file was deleted.

12 changes: 2 additions & 10 deletions .github/workflows/onboarding-api.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
name: Onboarding API
on:
push:
branches:
- main
paths:
- 'onboarding-api/**'
- '.github/workflows/onboarding-api.yml'
- '.github/actions/deploy-gfunction'
- '.github/actions/build-function'
pull_request:
paths:
- 'onboarding-api/**'
Expand All @@ -26,7 +18,7 @@ env:
artifact_name: "onboarding-api${{ inputs.deploy_env && format('-{0}', inputs.deploy_env) }}"
concurrency:
# Fancy concurrency group string to allow for multi-staging deployments
group: 'onboarding-api-${{ inputs.deploy_env || github.event.inputs.deploy_env }} @${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
group: 'onboarding-api-${{ inputs.deploy_env || github.event.inputs.deploy_env }}@${{ github.event.name }}${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -69,7 +61,7 @@ jobs:
deploy-onboarding-api:
concurrency:
# Don't try to deploy the same function in parallel
group: deploy-${{ needs.build-onboarding-api.outputs.function_name }}
group: deploy-${{ needs.build-onboarding-api.outputs.function_name }}-${{ github.event.name}}
cancel-in-progress: true
needs: build-onboarding-api
runs-on: ubuntu-latest
Expand Down
Loading
Loading