Deploy to production SCP instance #48
This file contains hidden or 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 production SCP instance | |
on: | |
workflow_dispatch: | |
inputs: | |
rollback: | |
type: choice | |
description: 'Y/N to rollback to previous release tag' | |
options: | |
- Y | |
- N | |
default: 'N' | |
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' | |
COMPUTE_ZONE: 'us-central1-a' | |
REMOTE_HOST: 'singlecell-01' | |
ROLLBACK: '' | |
jobs: | |
Deploy-To-Production: | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-24.04 | |
concurrency: | |
group: production-deployment | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Configure gcloud | |
uses: ./.github/actions/setup-gcloud | |
with: | |
service_account_email: '116798894341-compute@developer.gserviceaccount.com' | |
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: | | |
# set rollback flag, if requested | |
if [[ "${{ github.event.inputs.rollback }}" = "Y" ]]; then | |
ROLLBACK="-R" | |
fi | |
bin/deploy-github.sh -b main -e production -g ${{ env.GOOGLE_CLOUD_PROJECT }} -h ${{ env.REMOTE_HOST }} -p ${{ env.CONFIG_FILENAME }} -s ${{ env.DEFAULT_SA_KEYFILE }} -r ${{ env.READONLY_SA_KEYFILE }} $ROLLBACK |