Skip to content

Deploy to Playtest

Deploy to Playtest #44

name: Deploy to Playtest
on:
workflow_dispatch:
inputs:
service_name:
description: "Service name."
required: true
default: "publisher-web"
type: choice
options:
- publisher-web
- agency-dashboard-web
url_tag:
description: "Playtest URL tag. Must first be a registered Publisher Auth0 URL."
required: true
default: "test"
jobs:
playtest:
permissions:
contents: 'read'
id-token: 'write'
name: Deploy to Playtest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: "actions/checkout@v4"
- name: Authorize Github Actions
uses: "google-github-actions/auth@v2"
with:
service_account: ${{ secrets.JUSTICE_COUNTS_WIP_SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.JUSTICE_COUNTS_WIP_ID }}
project_id: "justice-counts-staging"
- uses: google-github-actions/setup-gcloud@v1
with:
version: latest
- name: Extract Branch Name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Start Deploy-to-playtesting Cloud Build trigger
run: |
gcloud --quiet builds triggers run Deploy-to-playtesting \
--branch=main \
--substitutions _SERVICE_NAME=${{ github.event.inputs.service_name }},_URL_TAG=${{ github.event.inputs.url_tag }},_SUBDIRECTORY=playtesting,_FRONTEND_URL=https://github.com/Recidiviz/justice-counts/archive/${{ steps.extract_branch.outputs.branch }}.tar.gz
- name: Bot Comment on Success
if: ${{ success() }}
run: gh pr comment ${{ steps.extract_branch.outputs.branch }} -b "@${{ github.triggering_actor }} successfully triggered a playtest deployment. Full deployment usually takes 5 minutes. Your playtest link is https://${{ github.event.inputs.url_tag }}---${{ github.event.inputs.service_name }}-b47yvyxs3q-uc.a.run.app/"
env:
GITHUB_TOKEN: ${{secrets.GH_HELPERBOT_TOKEN}}
- name: Bot Comment on Failure
if: ${{ failure() }}
run: gh pr comment ${{ steps.extract_branch.outputs.branch }} -b "@${{ github.triggering_actor }} Playtest deployment failed. See workflow failure logs at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
GITHUB_TOKEN: ${{secrets.GH_HELPERBOT_TOKEN}}