From 46d10c0a28dfbbb27f733b48a4713704171494a8 Mon Sep 17 00:00:00 2001 From: Mikel Alejo Barcina Ribera Date: Mon, 2 Oct 2023 10:58:19 +0200 Subject: [PATCH] feature: deploy to GitHub pages --- .github/workflows/deploy.yml | 57 ++++++++++++++++++++++++++++++++++++ static/.nojekyll | 0 svelte.config.js | 7 +++-- vite.config.ts | 3 ++ 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 static/.nojekyll diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..d9c9370 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,57 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: 'main' + +jobs: + build_site: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + # If you're using pnpm, add this step then change the commands and cache key below to use `pnpm` + # - name: Install pnpm + # uses: pnpm/action-setup@v2 + # with: + # version: 8 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + + - name: Install dependencies + run: npm install + + - name: build + env: + BASE_PATH: '/astrologenie' + run: | + npm run build + touch build/.nojekyll + + - name: Upload Artifacts + uses: actions/upload-pages-artifact@v1 + with: + # this should match the `pages` option in your adapter-static options + path: 'build/' + + deploy: + needs: build_site + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v1 diff --git a/static/.nojekyll b/static/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/svelte.config.js b/svelte.config.js index 1cf26a0..19ea94f 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -11,8 +11,11 @@ const config = { // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. // If your environment is not supported or you settled on a specific environment, switch out the adapter. // See https://kit.svelte.dev/docs/adapters for more information about adapters. - adapter: adapter() - } + adapter: adapter(), + paths: { + base: 'astrologenie' + } + }, }; export default config; diff --git a/vite.config.ts b/vite.config.ts index 37b6a84..4df9896 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,5 +5,8 @@ export default defineConfig({ plugins: [sveltekit()], test: { include: ['src/**/*.{test,spec}.{js,ts}'] + }, + "build": { + outDir: './build' } });