Skip to content

Fix keys

Fix keys #346

Workflow file for this run

name: Api - Backend
on:
workflow_dispatch:
push:
branches:
- master
- sandbox
paths:
- '.github/workflows/backend-api.yml'
- 'shared/**'
- 'backend/ji_core/**'
- 'backend/api/**'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
branch: "${{ steps.branch.outputs.value }}"
steps:
- name: Get branch from ref
id: branch
run: echo "value=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Ensure valid branch
if: false == contains(fromJson('["master", "sandbox"]'), steps.branch.outputs.value)
run: |
echo "::error ${{ steps.branch.outputs.value }} cannot be deployed"
exit 1
bundle:
needs: [prepare]
name: "[${{ needs.prepare.outputs.branch }}] Bundle"
runs-on: ubuntu-latest
steps:
- name: "Set environment"
env:
BRANCH: ${{ needs.prepare.outputs.branch }}
run: |
if [[ ${BRANCH} == 'master' ]]; then
echo "ENVIRONMENT=release" >> $GITHUB_ENV
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY }}" >> $GITHUB_ENV
elif [[ ${BRANCH} == 'sandbox' ]]; then
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY_SANDBOX }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
- name: Extract label
shell: bash
run: echo "value=\"[${{needs.prepare.outputs.branch}} - backend/api]\"" >> $GITHUB_OUTPUT
id: extract_label
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: davidB/rust-cargo-make@master
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ env.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}'
- name: install google cloud sdk
uses: google-github-actions/setup-gcloud@v1
- name: build and deploy api
run: cargo make ${{ env.ENVIRONMENT }}-api