feat: add emoji data handling and export route #32
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 api to preview | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: Run the workflow without creating a deployment | |
required: false | |
default: false | |
type: boolean | |
pull_request: | |
branches: | |
- main | |
types: [opened, synchronize] | |
# remove default permissions of GITHUB_TOKEN for security | |
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
permissions: {} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'mojisdev' | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: setup pnpm | |
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 | |
- name: setup node | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version: lts/* | |
- name: install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: build | |
run: pnpm build | |
- name: validate openapi | |
run: pnpm run lint:openapi | |
- name: lint | |
run: pnpm run lint | |
- name: typecheck | |
run: pnpm run typecheck | |
- name: test | |
run: pnpm run test | |
- name: generate api version | |
id: api-version | |
env: | |
HEAD_REF: ${{ github.head_ref }} | |
REF_NAME: ${{ github.ref_name }} | |
run: | | |
BRANCH_NAME="${HEAD_REF:-$REF_NAME}" | |
# replace forward slashes and special characters with hyphens | |
CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9]/-/g') | |
# get short SHA (first 7 characters) | |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
# combine | |
echo "version=$CLEAN_BRANCH-$SHORT_SHA" >> "$GITHUB_OUTPUT" | |
- name: deploy | |
if: ${{ github.event.inputs.dry-run != 'true' }} | |
env: | |
API_VERSION: ${{ steps.api-version.outputs.version }} | |
uses: cloudflare/wrangler-action@392082e81ffbcb9ebdde27400634aa004b35ea37 # v3.14.0 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
workingDirectory: . | |
environment: preview | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
vars: API_VERSION |