Skip to content

Commit

Permalink
Deployments to Google CDN (#678)
Browse files Browse the repository at this point in the history
* New GHA deployment for google cloud CDNs
  • Loading branch information
dividehex authored May 16, 2023
1 parent 9ccea45 commit 3a9dd5f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore all files by default
*
!/apps.yml
!images/
!images/*.png
38 changes: 38 additions & 0 deletions .github/workflows/google-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy

on:
workflow_call:
inputs:
environment:
required: true
type: string

env:
BUCKET_NAME: sso-dashboard-${{ inputs.environment }}

jobs:
deployment:
name: Deploy to Google CDN
environment: ${{ inputs.environment }}
permissions:
contents: 'read'
id-token: 'write'

runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'

- name: 'Upload to CDN bucket'
id: 'upload-to-bucket'
uses: 'google-github-actions/upload-cloud-storage@v1'
with:
path: './'
destination: '${{ env.BUCKET_NAME }}'
30 changes: 30 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Main workflow

on:
push:
release:
types: [published]
workflow_dispatch:

jobs:
call-test-configuration:
name: Test Dashboard Configuration
uses: ./.github/workflows/tests.yaml

call-deploy-configuration-to-dev:
name: Deploy to Development
if: github.event_name == 'push' && github.ref_name == 'master'
needs: call-test-configuration
uses: ./.github/workflows/google-deploy.yaml
with:
environment: development
secrets: inherit

call-deploy-configuration-to-prod:
name: Deploy to Production
if: github.event_name == 'release'
needs: call-test-configuration
uses: ./.github/workflows/google-deploy.yaml
with:
environment: production
secrets: inherit
12 changes: 7 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Test Configuration
name: Tests

on: [push, pull_request]
on:
workflow_call:

jobs:
build:
test:
name: Test Configuration
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Run tests via Makefile
Expand Down

0 comments on commit 3a9dd5f

Please sign in to comment.