Deploy to staging SCP instance #297
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
name: Deploy to staging SCP instance | |
on: | |
workflow_run: | |
workflows: ["Build and publish single-cell-portal Docker image"] | |
types: | |
- completed | |
branches: [development] | |
workflow_dispatch: | |
env: | |
DOCKER_IMAGE_NAME: 'gcr.io/broad-singlecellportal-staging/single-cell-portal' | |
CONFIG_FILENAME: 'scp_config.env' | |
DEFAULT_SA_KEYFILE: 'scp_service_account.json' | |
READONLY_SA_KEYFILE: 'read_only_service_account.json' | |
GOOGLE_CLOUD_PROJECT: 'broad-singlecellportal-staging' | |
COMPUTE_ZONE: 'us-central1-a' | |
REMOTE_HOST: 'singlecell-01' | |
jobs: | |
Deploy-To-Staging: | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-20.04 | |
concurrency: | |
group: staging-deployment | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Configure gcloud | |
uses: ./.github/actions/setup-gcloud | |
with: | |
service_account_email: '[email protected]' | |
google_cloud_project: ${{ env.GOOGLE_CLOUD_PROJECT }} | |
- name: Extract secrets to env file | |
uses: ./.github/actions/extract-gsm-secret-to-file | |
with: | |
google_cloud_project: ${{ env.GOOGLE_CLOUD_PROJECT }} | |
gsm_secret: 'scp-config-json' | |
output_filename: ${{ env.CONFIG_FILENAME }} | |
output_format: 'env' | |
- name: Extract secrets to env file | |
uses: ./.github/actions/extract-gsm-secret-to-file | |
with: | |
google_cloud_project: ${{ env.GOOGLE_CLOUD_PROJECT }} | |
gsm_secret: 'default-sa-keyfile' | |
output_filename: ${{ env.DEFAULT_SA_KEYFILE }} | |
output_format: 'json' | |
- name: Extract secrets to env file | |
uses: ./.github/actions/extract-gsm-secret-to-file | |
with: | |
google_cloud_project: ${{ env.GOOGLE_CLOUD_PROJECT }} | |
gsm_secret: 'read-only-sa-keyfile' | |
output_filename: ${{ env.READONLY_SA_KEYFILE }} | |
output_format: 'json' | |
- name: Run deploy script | |
shell: bash | |
run: | | |
bin/deploy-github.sh -b ${{ github.ref_name }} -e staging -g ${{ env.GOOGLE_CLOUD_PROJECT }} -h ${{ env.REMOTE_HOST }} -p ${{ env.CONFIG_FILENAME }} -s ${{ env.DEFAULT_SA_KEYFILE }} -r ${{ env.READONLY_SA_KEYFILE }} |