Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiorowski committed Jun 5, 2023
1 parent 3ca92fe commit 037713d
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 258 deletions.
170 changes: 85 additions & 85 deletions .github/workflows/deploy-client.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
name: Client Service
name: Deploy Client

on:
push:
branches:
- release-client/**
workflow_call:
secrets:
GCP_CREDENTIALS:
required: true
PUBLIC_API_KEY:
required: true
PUBLIC_AUTH_DOMAIN:
required: true
SERVICE_ACCOUNT:
required: true
STRIPE_API_KEY:
required: true
push:
branches:
- release-client/**
workflow_call:
secrets:
GCP_CREDENTIALS:
required: true
PUBLIC_API_KEY:
required: true
PUBLIC_AUTH_DOMAIN:
required: true
SERVICE_ACCOUNT:
required: true
STRIPE_API_KEY:
required: true

env:
GAR_LOCATION: europe-north1
PROJECT_ID: rusve-384620
REPOSITORY: rusve-repo
SERVICE: client
REGION: europe-north1
ENV: production
DOMAIN: https://www.rusve.app
URI_USERS_RUST: users-cdb5ecy4ia-lz.a.run.app
URI_USERS_GO: users-go-cdb5ecy4ia-lz.a.run.app
URI_UTILS: utils-cdb5ecy4ia-lz.a.run.app
URI_NOTES_RUST: notes-cdb5ecy4ia-lz.a.run.app
URI_NOTES_GO: notes-go-cdb5ecy4ia-lz.a.run.app
URI_DIRECTUS: https://directus-cms.fly.dev
PUBLIC_API_KEY: ${{ secrets.PUBLIC_API_KEY }}
PUBLIC_AUTH_DOMAIN: ${{ secrets.PUBLIC_AUTH_DOMAIN }}
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
GAR_LOCATION: europe-north1
PROJECT_ID: rusve-384620
REPOSITORY: rusve-repo
SERVICE: client
REGION: europe-north1
ENV: production
DOMAIN: https://www.rusve.app
URI_USERS_RUST: users-cdb5ecy4ia-lz.a.run.app
URI_USERS_GO: users-go-cdb5ecy4ia-lz.a.run.app
URI_UTILS: utils-cdb5ecy4ia-lz.a.run.app
URI_NOTES_RUST: notes-cdb5ecy4ia-lz.a.run.app
URI_NOTES_GO: notes-go-cdb5ecy4ia-lz.a.run.app
URI_DIRECTUS: https://directus-cms.fly.dev
PUBLIC_API_KEY: ${{ secrets.PUBLIC_API_KEY }}
PUBLIC_AUTH_DOMAIN: ${{ secrets.PUBLIC_AUTH_DOMAIN }}
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}

permissions:
contents: write
id-token: write
checks: write
contents: write
id-token: write
checks: write

jobs:
lint:
uses: ./.github/workflows/lint-client.yml
deploy:
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Docker Auth
id: docker-auth
uses: docker/login-action@v2
with:
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_CREDENTIALS }}
- name: Create .env.prod file
run: |
touch ./client/.env.prod
echo ENV="$ENV" >> ./client/.env.prod
echo DOMAIN="$DOMAIN" >> ./client/.env.prod
echo URI_USERS_RUST="$URI_USERS_RUST" >> ./client/.env.prod
echo URI_USERS_GO="$URI_USERS_GO" >> ./client/.env.prod
echo URI_UTILS="$URI_UTILS" >> ./client/.env.prod
echo URI_NOTES_RUST="$URI_NOTES_RUST" >> ./client/.env.prod
echo URI_NOTES_GO="$URI_NOTES_GO" >> ./client/.env.prod
echo URI_DIRECTUS="$URI_DIRECTUS" >> ./client/.env.prod
echo STRIPE_API_KEY="$STRIPE_API_KEY" >> ./client/.env.prod
echo PUBLIC_API_KEY="$PUBLIC_API_KEY" >> ./client/.env.prod
echo PUBLIC_AUTH_DOMAIN="$PUBLIC_AUTH_DOMAIN" >> ./client/.env.prod
echo SERVICE_ACCOUNT=\'$SERVICE_ACCOUNT\' >> ./client/.env.prod
- name: Build and Push Container
run: |-
docker build -f ./client/Dockerfile -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}" ./client
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}
lint:
uses: ./.github/workflows/lint-client.yml
deploy:
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Google Auth
id: auth
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- name: Docker Auth
id: docker-auth
uses: docker/login-action@v2
with:
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_CREDENTIALS }}
- name: Create .env.prod file
run: |
touch ./client/.env.prod
echo ENV="$ENV" >> ./client/.env.prod
echo DOMAIN="$DOMAIN" >> ./client/.env.prod
echo URI_USERS_RUST="$URI_USERS_RUST" >> ./client/.env.prod
echo URI_USERS_GO="$URI_USERS_GO" >> ./client/.env.prod
echo URI_UTILS="$URI_UTILS" >> ./client/.env.prod
echo URI_NOTES_RUST="$URI_NOTES_RUST" >> ./client/.env.prod
echo URI_NOTES_GO="$URI_NOTES_GO" >> ./client/.env.prod
echo URI_DIRECTUS="$URI_DIRECTUS" >> ./client/.env.prod
echo STRIPE_API_KEY="$STRIPE_API_KEY" >> ./client/.env.prod
echo PUBLIC_API_KEY="$PUBLIC_API_KEY" >> ./client/.env.prod
echo PUBLIC_AUTH_DOMAIN="$PUBLIC_AUTH_DOMAIN" >> ./client/.env.prod
echo SERVICE_ACCOUNT=\'$SERVICE_ACCOUNT\' >> ./client/.env.prod
- name: Build and Push Container
run: |-
docker build -f ./client/Dockerfile -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}" ./client
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}
2 changes: 1 addition & 1 deletion .github/workflows/deploy-notes-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Notes Go
on:
push:
branches:
- release-notes/**
- release-notes-go/**
workflow_call:
secrets:
GCP_CREDENTIALS:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-notes.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Notes Service
name: Deploy Notes Rust

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-users-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Users Go
on:
push:
branches:
- release-users/**
- release-users-go/**
workflow_call:
secrets:
GCP_CREDENTIALS:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-users.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Users Service
name: Deploy Users Rust

on:
push:
Expand Down
72 changes: 36 additions & 36 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Deploy
on:
push:
branches:
- release/**
push:
branches:
- release/**

permissions:
contents: write
id-token: write
checks: write
contents: write
id-token: write
checks: write

jobs:
deploy-client:
uses: ./.github/workflows/deploy-client.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
PUBLIC_API_KEY: ${{ secrets.PUBLIC_API_KEY }}
PUBLIC_AUTH_DOMAIN: ${{ secrets.PUBLIC_AUTH_DOMAIN }}
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
deploy-users:
uses: ./.github/workflows/deploy-users.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
deploy-users-go:
uses: ./.github/workflows/deploy-users-go.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
deploy-notes:
uses: ./.github/workflows/deploy-notes.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
deploy-notes-go:
uses: ./.github/workflows/deploy-notes-go.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
deploy-client:
uses: ./.github/workflows/deploy-client.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
PUBLIC_API_KEY: ${{ secrets.PUBLIC_API_KEY }}
PUBLIC_AUTH_DOMAIN: ${{ secrets.PUBLIC_AUTH_DOMAIN }}
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
deploy-users:
uses: ./.github/workflows/deploy-users.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
deploy-users-go:
uses: ./.github/workflows/deploy-users-go.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
deploy-notes:
uses: ./.github/workflows/deploy-notes.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
deploy-notes-go:
uses: ./.github/workflows/deploy-notes-go.yml
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
Loading

0 comments on commit 037713d

Please sign in to comment.