Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed/updated workflows #113

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Builds, pushes, and deploys the Skyviewer API container
name: 'Build and deploy branch-tagged Skyviewer API in Dev'
name: 'PR preview to Dev'

on:
pull_request:
Expand All @@ -13,7 +12,7 @@ on:

jobs:
build-push-deploy:
name: 'Build, Publish, and Deploy'
name: 'Build and Deploy PR preview to Development'
runs-on: ubuntu-latest
if: ${{ github.event.action != 'closed'}}

Expand All @@ -35,6 +34,7 @@ jobs:
docker build \
-t "gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }}" \
--build-arg NEXT_PUBLIC_API_URL=https://skyviewer-api-dot-skyviewer.uw.r.appspot.com/api \
--build-arg NEXT_PUBLIC_BASE_URL=https://skyviewer-client-dot-skyviewer.uw.r.appspot.com \
--build-arg NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-dot-skyviewer.uw.r.appspot.com/assets \
--build-arg NEXT_PUBLIC_ASTRO_API_URL=https://us-central1-skyviewer.cloudfunctions.net/astro-objects-api \
.
Expand All @@ -44,35 +44,28 @@ jobs:
- name: Push Container Image to GCR
run: docker push gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }}

- name: Get app.yaml
run: gcloud secrets versions access latest --secret=skyviewer-client-appyaml > app.yaml

- name: Format version name
id: version_name
run: echo "version_name=$(echo \"${{ github.head_ref }}\" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Deploy branch-tagged version to App Engine
env:
BRANCH_NAME: ${{ github.head_ref }}
run: |-
gcloud app deploy app.yaml \
--image-url=gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }} \
--version=${BRANCH_NAME,,} \
--version=${{ env.version_name }} \
--no-promote \
--project=${{ secrets.SV_PROJ_NAME }}

- 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
run: echo "version_url=$(gcloud app versions list --uri --service=skyviewer-client --filter=version.id:${{ env.version_name }})" >> $GITHUB_ENV

- name: Create or update a comment with the URL to the PR
- name: Post 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.
Expand All @@ -96,6 +89,10 @@ jobs:
project_id: ${{ secrets.SV_PROJ_NAME }}
export_default_credentials: true

- name: Format version name
id: version_name
run: echo "version_name=$(echo \"${{ github.head_ref }}\" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

# Destruct!
- name: Destroy version
run: gcloud app versions delete ${{ github.head_ref }} --service=skyviewer-client
run: gcloud app versions delete ${{ env.version_name }} --service=skyviewer-client
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Builds, pushes, and deploys the Skyviewer API container
name: 'Build and deploy Skyviewer Client to Google App Engine in Dev'
name: 'Deploy to Dev'

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

jobs:
build-push-deploy:
name: 'Build, Publish, and Deploy'
name: 'Build and Deploy to Development'
runs-on: ubuntu-latest

# Checkout the repository to the GitHub Actions runner
Expand All @@ -29,6 +28,7 @@ jobs:
docker build \
-t "gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }}" \
--build-arg NEXT_PUBLIC_API_URL=https://skyviewer-api-dot-skyviewer.uw.r.appspot.com/api \
--build-arg NEXT_PUBLIC_BASE_URL=https://skyviewer-client-dot-skyviewer.uw.r.appspot.com \
--build-arg NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-dot-skyviewer.uw.r.appspot.com/assets \
--build-arg NEXT_PUBLIC_ASTRO_API_URL=https://us-central1-skyviewer.cloudfunctions.net/astro-objects-api \
.
Expand All @@ -38,9 +38,13 @@ jobs:
- name: Push Container Image to GCR
run: docker push gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }}

- name: Get app.yaml
run: gcloud secrets versions access latest --secret=skyviewer-client-appyaml > app.yaml

- name: Deploy to App Engine
run: |-
gcloud app deploy app.yaml \
--quiet \
--image-url=gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }} \
--promote \
--project=${{ secrets.SV_PROJ_NAME }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Builds, pushes, and deploys the Skyviewer API container
name: 'Build and deploy branch-tagged Skyviewer API in Integration'
name: 'PR preview to Int'

on:
pull_request:
Expand All @@ -9,11 +8,11 @@ on:
- 'reopened'
- 'closed'
branches:
- 'master'
- 'main'

jobs:
build-push-deploy:
name: 'Build, Publish, and Deploy'
name: 'Build and Deploy PR preview to Integration'
runs-on: ubuntu-latest
if: ${{ github.event.action != 'closed'}}

Expand All @@ -34,8 +33,10 @@ jobs:
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_API_URL=https://skyviewer-api-dot-edc-int-6c5e.uc.r.appspot.com/api \
--build-arg NEXT_PUBLIC_BASE_URL=https://skyviewer-client-dot-edc-int-6c5e.uc.r.appspot.com \
--build-arg CRAFT_SECRET_TOKEN=abcdef0123456789 \
--build-arg NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-dot-edc-int-6c5e.uc.r.appspot.com/assets \
--build-arg NEXT_PUBLIC_ASTRO_API_URL=https://us-central1-skyviewer.cloudfunctions.net/astro-objects-api \
.
- name: Configure Docker Auth
Expand All @@ -44,42 +45,28 @@ jobs:
- 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: Get app.yaml
run: gcloud secrets versions access latest --secret=skyviewer-client-appyaml > app.yaml

- name: Format version name
id: version_name
run: echo "version_name=$(echo \"${{ github.head_ref }}\" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- 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,,} \
--version=${{ env.version_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
run: echo "version_url=$(gcloud app versions list --uri --service=skyviewer-client --filter=version.id:${{ env.version_name }})" >> $GITHUB_ENV

- name: Create or update a comment with the URL to the PR
- name: Post 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.
Expand All @@ -103,6 +90,10 @@ jobs:
project_id: edc-int-6c5e
export_default_credentials: true

- name: Format version name
id: version_name
run: echo "version_name=$(echo \"${{ github.head_ref }}\" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

# Destruct!
- name: Destroy version
run: gcloud app versions delete ${{ github.head_ref }} --service=skyviewer-client
run: gcloud app versions delete ${{ env.version_name }} --service=skyviewer-client
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Builds, pushes, and deploys the Skyviewer API container
name: 'Build and deploy Skyviewer Client to Google App Engine in Dev'
name: 'Deploy to Int'

on:
push:
branches:
- 'master'
- 'main'

jobs:
build-push-deploy:
name: 'Build, Publish, and Deploy'
name: 'Build and Deploy to Integration'
runs-on: ubuntu-latest

# Checkout the repository to the GitHub Actions runner
Expand All @@ -28,8 +27,10 @@ jobs:
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_API_URL=https://skyviewer-api-dot-edc-int-6c5e.uc.r.appspot.com/api \
--build-arg NEXT_PUBLIC_BASE_URL=https://skyviewer-client-dot-edc-int-6c5e.uc.r.appspot.com \
--build-arg CRAFT_SECRET_TOKEN=abcdef0123456789 \
--build-arg NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-dot-edc-int-6c5e.uc.r.appspot.com/assets \
--build-arg NEXT_PUBLIC_ASTRO_API_URL=https://us-central1-skyviewer.cloudfunctions.net/astro-objects-api \
.
- name: Configure Docker Auth
Expand All @@ -38,16 +39,13 @@ jobs:
- 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: Get app.yaml
run: gcloud secrets versions access latest --secret=skyviewer-client-appyaml > app.yaml

- name: Deploy to App Engine
run: |-
gcloud app deploy app.yaml \
--quiet \
--image-url=gcr.io/edc-int-6c5e/skyviewer-client:${{ github.sha }} \
--promote \
--project=edc-int-6c5e
54 changes: 54 additions & 0 deletions .github/workflows/gae-release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "🧶 Deploy to Prod 🐈"

on:
release:
types: [published]

jobs:
build-push-deploy:
name: "🧶 Build and Deploy to Production 🐈"
runs-on: ubuntu-latest

# 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.PIPELINE_EPO_PROD_PROJECT }}
project_id: edc-prod-eef0
export_default_credentials: true

- name: Format version name
id: version_name
run: echo "version_name=$(echo \"${{ github.ref_name }}\" | sed 's/[_.,\/]/-/g' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Build Container Image
run: |-
docker build \
-t "gcr.io/edc-prod-eef0/skyviewer-client:${{ env.version_name }}" \
--build-arg NEXT_PUBLIC_API_URL=https://skyviewer-api-dot-edc-prod-eef0.uc.r.appspot.com/api \
--build-arg NEXT_PUBLIC_BASE_URL=https://skyviewer-client-dot-edc-prod-eef0.uc.r.appspot.com \
--build-arg CRAFT_SECRET_TOKEN=abcdef0123456789 \
--build-arg NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-dot-edc-prod-eef0.uc.r.appspot.com/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-prod-eef0/rubin-obs-client:${{ env.version_name }}

- name: Get app.yaml
run: gcloud secrets versions access latest --secret=skyviewer-client-appyaml > app.yaml

- name: Deploy to App Engine
run: |-
gcloud app deploy app.yaml \
--image-url=gcr.io/edc-prod-eef0/rubin-obs-client:${{ env.version_name }} \
--version=${{ env.version_name }} \
--promote \
--project=edc-prod-eef0
Loading