Skip to content

Commit

Permalink
Merge pull request #19 from lsst-epo/EPO-8491
Browse files Browse the repository at this point in the history
Updated workflow files
  • Loading branch information
ericdrosas87 authored Sep 20, 2023
2 parents 1bd8feb + 7c76db3 commit c1f7452
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 14 deletions.
58 changes: 46 additions & 12 deletions .github/workflows/develop-pr-gae.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Build Image on PR Creation ~ Optional: Deploy Preview Instances'
name: 'PR Preview to Int'

on:
pull_request:
Expand All @@ -11,8 +11,8 @@ on:
- 'develop'

jobs:
build-image-no-deploy:
name: 'Build Image Without Deploy - No Preview'
build-push-deploy:
name: 'Build and Deploy PR Preview to Integration'
runs-on: ubuntu-latest
if: ${{ (github.event.action != 'closed') && (startsWith(github.head_ref, 'preview') == false) }}

Expand All @@ -28,18 +28,52 @@ jobs:
service_account_key: ${{ secrets.DEV_SA_KEY }}
project_id: skyviewer
export_default_credentials: true

- name: Get secret to create .env
run: gcloud secrets versions access latest --secret=investigations-api-env > ./api/.env
- name: Get app.yaml
run: gcloud secrets versions access latest --secret=rubin-obs-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,,}
- name: Setup docker build
uses: docker/setup-buildx-action@v2
id: buildx
# Create or update a comment with the URL
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: IMPORTANT! If this PR requires updated secrets

- name: Create or update a comment with reminder for secrets update
uses: peter-evans/create-or-update-comment@v1
with:
install: true
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:orangutan: IMPORTANT! If this PR requires updated secrets, please ensure they are updated in the dev environment in GCP! :orangutan:
reactions: '+1'
edit-mode: replace


# - 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 .
# - name: Build client, but don't deploy
# run: docker build .

build-push-deploy:
name: 'Build Image and Deploy Preview Version'
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/develop-push-gae.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,22 @@ jobs:
run: |
gcloud app deploy app.yaml \
--promote
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: IMPORTANT! If this PR requires updated secrets

- name: Create or update a comment with reminder for secrets update
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:orangutan: IMPORTANT! If this PR requires updated secrets, please ensure they are updated in the dev environment in GCP! :orangutan:
reactions: '+1'
edit-mode: replace

4 changes: 2 additions & 2 deletions .github/workflows/main-push-gae.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Push to Development after PR Merge'
name: 'Push to Integration upon force push'

on:
push:
Expand All @@ -7,7 +7,7 @@ on:

jobs:
build-push-deploy:
name: 'Deploy Development Version'
name: 'Deploy Integration Version'
runs-on: ubuntu-latest
if: ${{ github.event.action != 'closed'}}

Expand Down

0 comments on commit c1f7452

Please sign in to comment.