chore: add mit license (#631) #2134
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: 'Check code quality' | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
check-typescript: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/Iron | |
- name: Install dependencies | |
run: pnpm install | |
- name: Check TypeScript | |
run: pnpm tsc | |
check-prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/Iron | |
- name: Install dependencies | |
run: pnpm install | |
- name: Check Prettier & Eslint | |
run: pnpm run lint | |
build: | |
needs: [check-typescript, check-prettier] | |
runs-on: ubuntu-latest | |
environment: ${{ vars.CLOUDFLARE_PROJECT_NAME }} ${{ (github.ref == 'refs/heads/main' && '(Production)') || '(Preview)' }} | |
env: | |
VITE_BACKEND_URL: ${{ vars.BACKEND_URL }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/Iron | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm run build | |
- name: Save build cache | |
uses: actions/cache/save@v4 | |
with: | |
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }} | |
path: ./build | |
deploy-to-cloudflare: | |
needs: [build] | |
if: ${{ github.event_name != 'pull_request' || github.actor != 'dependabot[bot]' }} | |
permissions: | |
contents: read | |
deployments: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Retrieve build cache | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }} | |
path: ./build | |
- name: Publish to Cloudflare Pages | |
uses: andykenward/[email protected] | |
id: pages | |
with: | |
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
cloudflare-project-name: ${{ vars.CLOUDFLARE_PROJECT_NAME }} | |
directory: 'build' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
github-environment: ${{ vars.CLOUDFLARE_PROJECT_NAME }} ${{ (github.ref == 'refs/heads/main' && '(Production)') || '(Preview)' }} | |
- name: 'Delete old deployments' | |
uses: andykenward/github-actions-cloudflare-pages/[email protected] | |
with: | |
keep-latest: 5 | |
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
cloudflare-project-name: ${{ vars.CLOUDFLARE_PROJECT_NAME }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
github-environment: ${{ vars.CLOUDFLARE_PROJECT_NAME }} ${{ (github.event.pull_request.head.ref == 'refs/heads/main' && '(Production)') || '(Preview)' }} | |