Skip to content

Image Block, Two Col blocks, and config fixes #6

Image Block, Two Col blocks, and config fixes

Image Block, Two Col blocks, and config fixes #6

Workflow file for this run

name: 'PR Preview to Int'
on:
pull_request:
types:
- 'opened'
- 'synchronize'
- 'reopened'
- 'closed'
branches:
- 'main'
jobs:
build-image-no-deploy:
name: 'Build Image Without Deploy - No Preview'
runs-on: ubuntu-latest
if: ${{ (github.event.action != 'closed') && (startsWith(github.head_ref, 'preview') == false) }}
# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v2
# gcloud CLI setup
- name: Login to GCP
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.SKYVIEWER_INT_SERVICE_ACCOUNT }}
project_id: edc-int-6c5e
export_default_credentials: true
- name: Get secret to create .env
run: gcloud secrets versions access latest --secret=investigations-api-env > ./api/.env
- name: Setup docker build
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Build client, but don't deploy
run: docker build .
build-push-deploy:
name: 'Build Image and Deploy Preview Version'
runs-on: ubuntu-latest
if: ${{ (github.event.action != 'closed') && (startsWith(github.head_ref, 'preview') == true) }}
# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v2
# gcloud CLI setup
- name: Login to GCP
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.SKYVIEWER_INT_SERVICE_ACCOUNT }}
project_id: edc-int-6c5e
export_default_credentials: true
- name: Get app.yaml
run: gcloud secrets versions access latest --secret=investigations-api-appyaml > app.yaml
- name: Format version name
id: version_name
run: echo "version_name=$(echo \"${{ github.head_ref }}\" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]' | tr -d 'preview')" >> $GITHUB_ENV
- name: Deploy to App Engine
env:
BRANCH_NAME: ${{ env.version_name }}
run: |
gcloud app deploy app.yaml \
--no-promote \
--version=${BRANCH_NAME,,}
cleanup:
name: 'Cleanup PR Preview'
runs-on: ubuntu-latest
if: ${{ (github.event.action == 'closed') && (startsWith(github.head_ref, 'preview') == true) }}
# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v2
# gcloud CLI setup
- name: Login to GCP
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.SKYVIEWER_INT_SERVICE_ACCOUNT }}
project_id: edc-int-6c5e
export_default_credentials: true
# Destruct!
- name: Destroy version
env:
BRANCH_NAME: ${{ env.version_name }}
run: gcloud app versions delete ${BRANCH_NAME,,} --service=investigations-api