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

Bugfix/fix build error #139

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
type=gha
build-args: |
BASE_TAG=k8s
RUN_BUILD=false
-
uses: imjasonh/[email protected]
if: ${{ github.event_name == 'pull_request' }}
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/gae-develop-with-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: 'PR preview to Dev'

on:
pull_request:
types:
- 'opened'
- 'synchronize'
- 'reopened'
- 'closed'
branches:
- 'develop'

jobs:
build-push-deploy:
name: 'Build and Deploy PR preview to Development'
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.DEV_SA_KEY }}
project_id: ${{ secrets.SV_PROJ_NAME }}
export_default_credentials: true

- name: Build Container Image
run: |-
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 \
.
- name: Configure Docker Auth
run: gcloud --quiet auth configure-docker

- 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
run: |-
gcloud app deploy app.yaml \
--image-url=gcr.io/${{ secrets.SV_PROJ_NAME }}/skyviewer-client:${{ github.sha }} \
--version=${{ env.version_name }} \
--no-promote \
--project=${{ secrets.SV_PROJ_NAME }}

- name: Get the version URL
id: get_version
run: echo "version_url=$(gcloud app versions list --uri --service=skyviewer-client --filter=version.id:${{ env.version_name }})" >> $GITHUB_ENV

- name: Post the URL to the PR
uses: peter-evans/create-or-update-comment@v1
with:
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.DEV_SA_KEY }}
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 ${{ env.version_name }} --service=skyviewer-client
50 changes: 50 additions & 0 deletions .github/workflows/gae-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Deploy to Dev'

on:
push:
branches:
- 'develop'

jobs:
build-push-deploy:
name: 'Build and Deploy to Development'
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.DEV_SA_KEY }}
project_id: ${{ secrets.SV_PROJ_NAME }}
export_default_credentials: true

- name: Build Container Image
run: |-
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 \
.
- name: Configure Docker Auth
run: gcloud --quiet auth configure-docker

- 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 }}
99 changes: 99 additions & 0 deletions .github/workflows/gae-master-with-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: 'PR preview to Int'

on:
pull_request:
types:
- 'opened'
- 'synchronize'
- 'reopened'
- 'closed'
branches:
- 'master'

jobs:
build-push-deploy:
name: 'Build and Deploy PR preview to Integration'
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-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
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: 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
run: |-
gcloud app deploy app.yaml \
--image-url=gcr.io/edc-int-6c5e/skyviewer-client:${{ github.sha }} \
--version=${{ env.version_name }} \
--no-promote \
--project=edc-int-6c5e

- name: Get the version URL
id: get_version
run: echo "version_url=$(gcloud app versions list --uri --service=skyviewer-client --filter=version.id:${{ env.version_name }})" >> $GITHUB_ENV

- name: Post the URL to the PR
uses: peter-evans/create-or-update-comment@v1
with:
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

- 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 ${{ env.version_name }} --service=skyviewer-client
51 changes: 51 additions & 0 deletions .github/workflows/gae-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'Deploy to Int'

on:
push:
branches:
- 'master'

jobs:
build-push-deploy:
name: 'Build and Deploy to Integration'
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.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-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
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: 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ARG NEXT_PUBLIC_BASE_URL
ARG NEXT_PUBLIC_ASTRO_API_URL
ARG CRAFT_SECRET_TOKEN

RUN npx browserslist@latest --update-db && yarn static:build
RUN npx update-browserslist-db@latest && yarn static:build

# Production image, copy all the files and run next
FROM node:20-alpine AS runner
Expand Down
Loading