From d14cd2bfde0949134a03d23bed25bc09e0100623 Mon Sep 17 00:00:00 2001 From: Val Gorodnichev Date: Thu, 21 Nov 2024 12:22:04 -0700 Subject: [PATCH 1/4] feat: deploying to netlify --- .../workflows/{github-pages.yaml => ci.yaml} | 24 +++++-------------- vite.config.ts | 2 +- 2 files changed, 7 insertions(+), 19 deletions(-) rename .github/workflows/{github-pages.yaml => ci.yaml} (70%) diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/ci.yaml similarity index 70% rename from .github/workflows/github-pages.yaml rename to .github/workflows/ci.yaml index 622c443..7491a18 100644 --- a/.github/workflows/github-pages.yaml +++ b/.github/workflows/ci.yaml @@ -1,7 +1,7 @@ -name: Deploy Spec Editor to GitHub Pages +name: Build spec-editor on: - push: + pull_request: branches: - main @@ -17,12 +17,13 @@ permissions: # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: - group: 'pages' - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: # Single deploy job since we're just deploying - deploy: + build: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -43,16 +44,3 @@ jobs: - name: Build Spec Editor run: pnpm build - - - name: Setup Pages - uses: actions/configure-pages@v5 - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - # Upload sandbox/dist directory - path: './dist' - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/vite.config.ts b/vite.config.ts index 78c00b0..35c0189 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,7 +9,7 @@ const externalDependencies: string[] = ['shiki/onig.wasm'] // https://vite.dev/config/ export default defineConfig({ - base: '/spec-editor', + base: '/', plugins: [ vue(), vueDevTools(), From 22fbc7f260ffeeed1ca014cab514d436e894f6f0 Mon Sep 17 00:00:00 2001 From: Val Gorodnichev Date: Thu, 21 Nov 2024 12:28:24 -0700 Subject: [PATCH 2/4] fix: remove pages --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7491a18..21c7db9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,6 @@ on: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read - pages: write id-token: write # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. From db49df13c530593375c00d5cfc81660246b5241e Mon Sep 17 00:00:00 2001 From: Val Gorodnichev Date: Thu, 21 Nov 2024 12:31:05 -0700 Subject: [PATCH 3/4] fix: remove ci --- .github/workflows/ci.yaml | 45 --------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 21c7db9..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Build spec-editor - -on: - pull_request: - branches: - - main - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - - -jobs: - # Single deploy job since we're just deploying - build: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - timeout-minutes: 10 - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM with Dependencies - uses: ./.github/actions/setup-pnpm-with-dependencies/ - with: - force-install: true - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build Spec Editor - run: pnpm build From 90f92918b7640a24a01626c46083df858aea6850 Mon Sep 17 00:00:00 2001 From: Val Gorodnichev Date: Thu, 21 Nov 2024 12:33:01 -0700 Subject: [PATCH 4/4] fix: remove action --- .../setup-pnpm-with-dependencies/action.yaml | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 .github/actions/setup-pnpm-with-dependencies/action.yaml diff --git a/.github/actions/setup-pnpm-with-dependencies/action.yaml b/.github/actions/setup-pnpm-with-dependencies/action.yaml deleted file mode 100644 index 1e0c6fb..0000000 --- a/.github/actions/setup-pnpm-with-dependencies/action.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: Setup PNPM with Yarn Dependencies -description: Reusable composition of setup-node, cache, and pnpm install actions -inputs: - nodejs-version: - description: 'Version of NodeJS to use (ex: 18.18.2)' - default: '18.18.2' - force-install: - description: When 'true', pnpm install will be executed regardless of a cache hit - required: false - default: 'false' - frozen-lockfile: - description: When false, pnpm install will use the --no-frozen-lockfile flag - required: false - default: 'true' -outputs: - cache-hit: - description: Whether or not there was a cache hit - value: ${{ steps.dependency-cache.outputs.cache-hit }} -runs: - using: composite - steps: - - - name: get Node version - id: node-version - shell: bash - run: | - voltaNodeVersion=$(cat package.json|jq -r ".volta.node") - if [[ $voltaNodeVersion == null ]]; then - voltaNodeVersion="${{ inputs.nodejs-version }}" - fi - voltaPnpmVersion=$(cat package.json|jq -r ".volta.pnpm") - if [[ $voltaPnpmVersion == null ]]; then - voltaPnpmVersion="8.10.5" - fi - - echo "node-version=${voltaNodeVersion}">> $GITHUB_OUTPUT - echo "pnpm-version=${voltaPnpmVersion}">> $GITHUB_OUTPUT - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.node-version.outputs.node-version }} - - - name: Install PNPM - shell: bash - run: | - npm i -g pnpm@${{ steps.node-version.outputs.pnpm-version }} - pnpm --version - - - - name: Dependency Cache - id: dependency-cache - uses: actions/cache@v4 - with: - path: '**/node_modules' - key: pnpm-${{ steps.node-version.outputs.pnpm-version }}-${{ steps.node-version.outputs.node-version }}-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - - - name: Install Dependencies - if: ${{ inputs.force-install == 'true' || steps.dependency-cache.outputs.cache-hit != 'true' }} - shell: bash - run: pnpm i${{ inputs.frozen-lockfile == 'false' && ' --no-frozen-lockfile' || '' }}