style: 💄 tighten up all labels #24
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
name: Switch Demo CICD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
name: "Test" | |
runs-on: ubuntu-latest | |
env: | |
JWT_SECRET: "test.fake.secret" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: "Bun test" | |
run: | | |
bun install | |
bunx tsr generate | |
bun test | |
# TODO: bun build:lib && https://github.com/marketplace/actions/bump-version-package-json | |
docker: | |
needs: test | |
name: "Docker Build & Publish to AR" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: google-github-actions/setup-gcloud@v2 | |
- uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: "${{ secrets.GCP_CICD_KEY }}" | |
- name: "Auth to AR" | |
run: gcloud auth configure-docker us-east4-docker.pkg.dev | |
- name: "Push to AR" | |
run: | | |
docker build . \ | |
-f Dockerfile.node \ | |
-t ${{ secrets.GCP_AR_PATH }}/app:${GITHUB_SHA::6} \ | |
-t ${{ secrets.GCP_AR_PATH }}/app:latest | |
docker push ${{ secrets.GCP_AR_PATH }}/app:${GITHUB_SHA::6} | |
docker push ${{ secrets.GCP_AR_PATH }}/app:latest | |
deploy: | |
name: "Deploy on Cloud Run" | |
runs-on: ubuntu-latest | |
needs: docker | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: google-github-actions/setup-gcloud@v2 | |
- uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: "${{ secrets.GCP_CICD_KEY }}" | |
- name: "Deploy" | |
if: | |
run: | | |
echo "LOG_LEVEL: error" >> env.yaml | |
echo "SELF_RPC_HOST: https://surface-demo-app-5v6fvk5ela-uw.a.run.app/" >> env.yaml | |
gcloud run deploy switch-demo-app \ | |
--image "${{ secrets.GCP_AR_PATH }}/app:${GITHUB_SHA::6}" \ | |
--env-vars-file env.yaml \ | |
--service-account ${{ secrets.GCP_APP_SERVICE_ACCOUNT }} \ | |
--region us-west1 \ | |
--allow-unauthenticated |