Skip to content

feat: add api/env

feat: add api/env #33

Workflow file for this run

name: Prerelease
on:
workflow_dispatch:
pull_request:
types:
- opened
- labeled
- synchronize
permissions:
pull-requests: write
issues: write
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- locale: en
vercel_project_id_key: VERCEL_PROJECT_EN_ID
- locale: zh-hans
vercel_project_id_key: VERCEL_PROJECT_ZH_HANS_ID
- locale: zh-hant
vercel_project_id_key: VERCEL_PROJECT_ZH_HANT_ID
# Add more locales here as needed
name: Deploy ${{ matrix.locale }}
steps:
- name: Calculate should_deploy
id: should_deploy
shell: bash
run: |
LABELS_JSON='${{ toJson(github.event.pull_request.labels.*.name) }}'
echo "LABELS_JSON: $LABELS_JSON"
SHOULD_DEPLOY=false
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
SHOULD_DEPLOY=true
elif echo "$LABELS_JSON" | grep -E '"prerelease"' > /dev/null; then
SHOULD_DEPLOY=true
elif echo "$LABELS_JSON" | grep -E '"prerelease:'"${{ matrix.locale }}"'"' > /dev/null; then
SHOULD_DEPLOY=true
fi
echo "should_deploy=$SHOULD_DEPLOY" >> $GITHUB_OUTPUT
- name: Skip job if not needed
if: steps.should_deploy.outputs.should_deploy != 'true'
run: |
echo "Skipping deploy for ${{ matrix.locale }} due to missing label."
exit 78
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Deploy ${{ matrix.locale }}
uses: ./.github/actions/prerelease
with:
locale: ${{ matrix.locale }}
vercel_project_id: ${{ secrets[matrix.vercel_project_id_key] }}