Skip to content

Commit

Permalink
Adding CI for the Site (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion authored Nov 29, 2024
1 parent 3bd1118 commit 3c2759f
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [3-add-ci]

# 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
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

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm
# with:
# version: 9 # Not needed if you've set "packageManager" in package.json
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci # or pnpm install / yarn install / bun install
- uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.PAT_TOKEN }}
workflow: DocC.yml
name: artifact
repo: brightdigit/BushelKit
workflow_conclusion: success
- name: Decompress Archive
run: |
mkdir -p public
tar -xf BushelKit.doccarchive.tar -C public
mv public/BushelKit.doccarchive public/swift-docc
- name: Build with VitePress
run: npm run docs:production # or pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: .vitepress/dist

# Deployment job
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
4 changes: 2 additions & 2 deletions docc.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const baseURL =
? 'https://docs.getbushel.app'
: 'http://localhost:3000'

const modules = fs.readdirSync("public/swift-docc").filter( (name) => {
const modules = fs.readdirSync("public/swift-docc/documentation").filter( (name) => {
return name.toLocaleLowerCase().startsWith("bushel")
}).map((name) => {
const lowerCase = name.toLocaleLowerCase()
return {
text: name,
link: `${baseURL}/swift-docc/${name}/documentation/${lowerCase}/`,
link: `${baseURL}/swift-docc/documentation/${lowerCase}/`,
target: "_self"
}
})
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
"docs:preview": "vitepress preview",
"docs:production": "cross-env ENVIRONMENT=production vitepress build"
},
"devDependencies": {
"@types/node": "^22.10.1",
Expand Down

0 comments on commit 3c2759f

Please sign in to comment.