From bd94c92fb3473c49182603491569b69b411b20bf Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:01:19 -0500 Subject: [PATCH] ci: reboot --- .github/workflows/ci.yaml | 133 ++++++++++++++++++ .../gpa-calculator/.github/workflows/main.yml | 84 ----------- apps/phs-map/.github/workflows/deploy.yaml | 80 ----------- 3 files changed, 133 insertions(+), 164 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 apps/gpa-calculator/.github/workflows/main.yml delete mode 100644 apps/phs-map/.github/workflows/deploy.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..9f9ddaa --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,133 @@ +--- +name: Continuous Integration + +on: + # Run on pushes to the default branch. + push: + branches: + - main + + # Run on all PRs. + pull_request: + types: + - opened + - synchronize + - reopened + + # Support merge queues. + merge_group: + + # Run on a schedule. + schedule: + - cron: "0 14 * * 1" # Every Monday at 9 in the morning CST + + # Allow running this workflow manually from the Actions tab. + workflow_dispatch: + +env: + DENO_VERSION: v1.44.4 + +permissions: + contents: read # Needed to clone the repository + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: 📚 Git checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + submodules: recursive + clean: true + persist-credentials: false + set-safe-directory: true + - name: 🥟 Install Bun + uses: oven-sh/setup-bun@123c6c4e2fea3eb7bffaa91a85eb6b3d505bf7af # v2 + with: + bun-version: 1.1.18 + - name: ⚙️ Cache Turbo + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + id: cache + with: + path: .turbo + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- + - name: 📦 Install dependencies + run: bun --bun install --frozen-lockfile + env: + SHARP_IGNORE_GLOBAL_LIBVIPS: 1 + - name: 🌐 Disable analytics + run: bun --bun run turbo telemetry disable + - name: 🔨 Build + run: bun --bun run turbo run build + - name: ⚙️ Upload GPA Calculator + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 + with: + name: gpa-calculator + path: "./apps/gpa-calculator/dist/" + - name: ⚙️ Upload Map + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 + with: + name: phs-map + path: "./apps/phs-map/dist/" + + deploy-calculator: + name: Deploy GPA Calculator + needs: [build] + if: github.event_name == 'push' + runs-on: ubuntu-latest + timeout-minutes: 4 + permissions: + id-token: write # Needed for auth with Deno Deploy + concurrency: + group: ${{ github.workflow }}-deploy + cancel-in-progress: true + + steps: + - name: 🦕 Install Deno + uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4 + with: + deno-version: ${{ env.DENO_VERSION }} + - name: ⚙️ Download GPA Calculator + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: gpa-calculator + - name: 🔧 Upload to Deno Deploy + id: deploy + uses: denoland/deployctl@612f83df2b874c6908d68de5cf3f36a6538fa8f7 # 1.12.0 + with: + project: "gpa-calculator" + entrypoint: https://deno.land/std@0.224.0/http/file_server.ts + root: "./apps/gpa-calculator/dist/" + + deploy-map: + name: Deploy Map + needs: [build] + if: github.event_name == 'push' + runs-on: ubuntu-latest + timeout-minutes: 4 + permissions: + id-token: write # Needed for auth with Deno Deploy + concurrency: + group: ${{ github.workflow }}-deploy + cancel-in-progress: true + + steps: + - name: 🦕 Install Deno + uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4 + with: + deno-version: ${{ env.DENO_VERSION }} + - name: ⚙️ Download Map + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: phs-map + - name: 🔧 Upload to Deno Deploy + id: deploy + uses: denoland/deployctl@612f83df2b874c6908d68de5cf3f36a6538fa8f7 # 1.12.0 + with: + project: "phs-map" + entrypoint: https://deno.land/std@0.224.0/http/file_server.ts + root: "./apps/phs-map/dist/" diff --git a/apps/gpa-calculator/.github/workflows/main.yml b/apps/gpa-calculator/.github/workflows/main.yml deleted file mode 100644 index e85a1fb..0000000 --- a/apps/gpa-calculator/.github/workflows/main.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -name: Deploy to GitHub Pages - -env: - CI: true - -on: - # Runs on pushes to the default branch - push: - branches: - - main - - # Runs on PRs targeting the default branch - pull_request: - types: [opened, synchronize, reopened, closed] - branches: - - main - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build_job: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.5.0 - with: - submodules: true - - - name: Install bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: 1.0.29 - - - name: Cache - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - id: cache - with: - path: | - .turbo - node_modules - ~/.bun/install/cache - key: ${{ runner.os }}-${{ runner.arch }}-node_modules-${{ hashFiles('**/bun.lockb', '**/turbo.json') }} - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: bun --bun install --frozen-lockfile - env: - SHARP_IGNORE_GLOBAL_LIBVIPS: 1 - - - name: Lint & Build - run: bun --bun run turbo build - - - name: Redirect 404 to Index for SPA - run: cp dist/index.html dist/404.html - - - name: Setup Pages - uses: actions/configure-pages@v3.0.5 - - - name: Upload Artifact - uses: actions/upload-pages-artifact@v1.0.8 - with: - path: "./dist/" - - deploy_job: - name: Deploy - needs: [build_job] - if: github.event_name == 'push' - runs-on: ubuntu-latest - timeout-minutes: 4 - permissions: - pages: write - id-token: write - contents: read - concurrency: - group: "pages" - cancel-in-progress: true - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - id: deployment - uses: actions/deploy-pages@v2.0.0 diff --git a/apps/phs-map/.github/workflows/deploy.yaml b/apps/phs-map/.github/workflows/deploy.yaml deleted file mode 100644 index b7bcbd5..0000000 --- a/apps/phs-map/.github/workflows/deploy.yaml +++ /dev/null @@ -1,80 +0,0 @@ ---- -name: Deploy to GitHub Pages - -env: - CI: true - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - merge_group: - schedule: - - cron: "0 14 * * 1" # every monday at 9 in the morning CST - workflow_dispatch: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: 📚 Git checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - submodules: recursive - clean: true - persist-credentials: false - set-safe-directory: true - - name: 🥟 Install Bun - uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7 # v1.1.0 - with: - bun-version: 1.1.12 - - name: ⚙️ Cache Turbo - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - id: cache - with: - path: .turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-turbo- - - name: 📦 Install dependencies - run: bun --bun install --frozen-lockfile - env: - SHARP_IGNORE_GLOBAL_LIBVIPS: 1 - - name: 🌐 Disable analytics - run: bun --bun run turbo telemetry disable - - name: 🔨 Build - run: bun --bun run turbo build - - name: 📃 Setup Pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - - name: ⚙️ Upload Artifact - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 - with: - path: "./dist/" - - deploy: - name: Deploy - needs: [build] - if: github.event_name == 'push' - runs-on: ubuntu-latest - timeout-minutes: 4 - permissions: - pages: write - id-token: write - contents: read - concurrency: - group: "pages" - cancel-in-progress: true - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - steps: - - name: 🔧 Deploy - id: deployment - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5