From d6675ca9c6abb4065bb409f6e848d07ea8b009ef Mon Sep 17 00:00:00 2001 From: Alexandr Yermak Date: Sun, 6 Oct 2024 17:58:11 +1000 Subject: [PATCH] deploy docs --- .github/workflows/deploy-docs.yml | 79 +++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 30 ------------ .husky/pre-commit | 4 -- docs/README.md | 55 --------------------- docs/astro.config.mjs | 2 + 5 files changed, 81 insertions(+), 89 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml delete mode 100644 .github/workflows/publish.yml delete mode 100755 .husky/pre-commit delete mode 100644 docs/README.md diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..7fdf4ff --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,79 @@ +name: Deploy Astro site to Pages + +on: + push: + branches: ["master"] + +permissions: + contents: read + pages: write + 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: "pages" + cancel-in-progress: false + +env: + BUILD_PATH: "./docs" + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup bun + uses: oven-sh/setup-bun@v2 + + - name: Detect package manager + id: detect-package-manager + run: | + echo "manager=bun" >> $GITHUB_OUTPUT \ + echo "command=install" >> $GITHUB_OUTPUT \ + echo "runner=bun" >> $GITHUB_OUTPUT \ + echo "lockfile=bun.lockb" >> $GITHUB_OUTPUT \ + exit 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }} + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + + - name: Install dependencies + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + working-directory: ${{ env.BUILD_PATH }} + + - name: Build with Astro + run: | + ${{ steps.detect-package-manager.outputs.runner }} astro build \ + --site "${{ steps.pages.outputs.origin }}" \ + --base "${{ steps.pages.outputs.base_path }}" + working-directory: ${{ env.BUILD_PATH }} + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ${{ env.BUILD_PATH }}/dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + name: Deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 35a42c3..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,30 +0,0 @@ -# .github/workflows/publish.yml -name: Build branch - -on: - push: - branches: - - master # Remove this line if your primary branch is "main" - -jobs: - build: - runs-on: ubuntu-latest - name: Build branch - steps: - - name: git-checkout - uses: actions/checkout@v3 - - - name: Install all dependencies - run: yarn install - - - name: Build - run: yarn _build:ga # The build command of your project - - - name: Push - uses: s0/git-publish-subdir-action@develop - env: - REPO: self - BRANCH: build # The branch name where you want to push the assets - FOLDER: build # The directory where your assets are generated - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token - MESSAGE: 'Build: ({sha}) {msg}' # The commit message diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index cf0c46b..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npx --no-install lint-staged diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index e09bf55..0000000 --- a/docs/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Starlight Starter Kit: Basics - -[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) - -``` -npm create astro@latest -- --template starlight -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) -[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) -[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics) -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs) - -> πŸ§‘β€πŸš€ **Seasoned astronaut?** Delete this file. Have fun! - -## πŸš€ Project Structure - -Inside of your Astro + Starlight project, you'll see the following folders and files: - -``` -. -β”œβ”€β”€ public/ -β”œβ”€β”€ src/ -β”‚ β”œβ”€β”€ assets/ -β”‚ β”œβ”€β”€ content/ -β”‚ β”‚ β”œβ”€β”€ docs/ -β”‚ β”‚ └── config.ts -β”‚ └── env.d.ts -β”œβ”€β”€ astro.config.mjs -β”œβ”€β”€ package.json -└── tsconfig.json -``` - -Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. - -Images can be added to `src/assets/` and embedded in Markdown with a relative link. - -Static assets, like favicons, can be placed in the `public/` directory. - -## 🧞 Commands - -All commands are run from the root of the project, from a terminal: - -| Command | Action | -| :------------------------ | :----------------------------------------------- | -| `npm install` | Installs dependencies | -| `npm run dev` | Starts local dev server at `localhost:4321` | -| `npm run build` | Build your production site to `./dist/` | -| `npm run preview` | Preview your build locally, before deploying | -| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | -| `npm run astro -- --help` | Get help using the Astro CLI | - -## πŸ‘€ Want to learn more? - -Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index a8eca57..80e21d9 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -5,6 +5,8 @@ import react from '@astrojs/react'; // https://astro.build/config export default defineConfig({ + site: 'https://postrockreverb.github.io/derived', + base: 'derived', integrations: [ starlight({ title: '@postrockreverb/derived',