Deploy App #22
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: Deploy App | |
on: | |
workflow_dispatch: | |
inputs: | |
skip-rebuild-images: | |
description: Skip rebuilding images | |
required: false | |
type: boolean | |
default: false | |
jobs: | |
deploy-app: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Google authentication | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
- name: Set up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Configure Docker client | |
run: gcloud auth configure-docker | |
- name: Build deployment container | |
run: cd deploy && make build | |
- name: Deploy app | |
env: | |
VERITAS_TRIAL_SERVICE_CREDENTIALS: /tmp/veritas-trial-service.json | |
SSL_CERTIFICATE_CRT: /tmp/certificate.crt | |
SSL_PRIVATE_KEY: /tmp/private.key | |
run: | | |
cd deploy | |
printf "%s" "${{ secrets.VERITAS_TRIAL_SERVICE_KEY }}" > /tmp/veritas-trial-service.json | |
printf "%s" "${{ secrets.SSL_CERTIFICATE_CRT }}" > /tmp/certificate.crt | |
printf "%s" "${{ secrets.SSL_PRIVATE_KEY }}" > /tmp/private.key | |
make gh-actions command="./deploy-app.sh --skip-rebuild-images=${{ inputs.skip-rebuild-images }}" | |
rm /tmp/veritas-trial-service.json | |
rm /tmp/certificate.crt | |
rm /tmp/private.key | |
- name: Create PR | |
id: create-pr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.CHARLIE_XIAO_PAT }} | |
labels: app, ci/cd | |
title: "cd: updates of app deployment" | |
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | |
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | |
commit-message: | | |
cd: updates of app deployment | |
Co-authored-by: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | |
body: | | |
This PR was triggered by @${{ github.actor }} in ${{ github.workflow }}. | |
Check the workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: Enable auto-merge | |
if: ${{ steps.create-pr.outputs.pull-request-number != '' }} | |
run: gh pr merge --squash --auto "$PR_NUMBER" | |
env: | |
GH_TOKEN: ${{ secrets.CHARLIE_XIAO_PAT }} | |
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }} |