Revert "Develop" #39
Workflow file for this run
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
# Builds, pushes, and deploys the Skyviewer API container | |
name: 'Build and deploy branch-tagged Skyviewer API in Integration' | |
on: | |
pull_request: | |
types: | |
- 'opened' | |
- 'synchronize' | |
- 'reopened' | |
- 'closed' | |
branches: | |
- 'master' | |
jobs: | |
build-push-deploy: | |
name: 'Build, Publish, and Deploy' | |
runs-on: ubuntu-latest | |
if: ${{ github.event.action != 'closed'}} | |
# 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: Build Container Image | |
run: |- | |
docker build \ | |
-t "gcr.io/edc-int-6c5e/skyviewer-client:${{ github.sha }}" \ | |
--build-arg NEXT_PUBLIC_API_URL=https://skyviewer-api-int-2eici5myiq-uc.a.run.app/api \ | |
--build-arg NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-int-2eici5myiq-uc.a.run.app/assets \ | |
--build-arg NEXT_PUBLIC_ASTRO_API_URL=https://us-central1-skyviewer.cloudfunctions.net/astro-objects-api \ | |
. | |
- name: Configure Docker Auth | |
run: gcloud --quiet auth configure-docker | |
- name: Push Container Image to GCR | |
run: docker push gcr.io/edc-int-6c5e/skyviewer-client:${{ github.sha }} | |
- name: Update app.yaml | |
run: |- | |
echo " | |
network: | |
name: edc-int-vpc | |
subnetwork_name: subnet-us-central1-01" >> app.yaml | |
- name: Deploy branch-tagged version to App Engine | |
env: | |
BRANCH_NAME: ${{ github.head_ref }} | |
run: |- | |
gcloud app deploy app.yaml \ | |
--image-url=gcr.io/edc-int-6c5e/skyviewer-client:${{ github.sha }} \ | |
--version=${BRANCH_NAME,,} \ | |
--no-promote \ | |
--project=edc-int-6c5e | |
- name: Get the version URL | |
id: get_version | |
env: | |
BRANCH_NAME: ${{ github.head_ref }} | |
run: echo "version_url=$(gcloud app versions list --uri --service=skyviewer-client --filter=version.id:${BRANCH_NAME,,})" >> $GITHUB_ENV | |
# 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: A preview of this PR | |
- name: Create or update a comment with the URL to the PR | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
A preview of this PR will be available at ${{ env.version_url }} until the request is closed. | |
reactions: '+1' | |
cleanup: | |
name: 'Cleanup PR Preview' | |
runs-on: ubuntu-latest | |
if: ${{ github.event.action == 'closed'}} | |
# 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 | |
run: gcloud app versions delete ${{ github.head_ref }} --service=skyviewer-client |