Skip to content

Commit

Permalink
ci: deploy docs via github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Jan 8, 2025
1 parent b3ec8ad commit a80577a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,22 @@ jobs:
draft: false
prerelease: false
generate_release_notes: true

deploy-docs:
name: Deploy docs
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4

- name: Build
run: npm ci && npm run build:release
working-directory: docs

- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy docs/.vitepress/dist --project-name=blink-cmp
10 changes: 5 additions & 5 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
import taskLists from 'markdown-it-task-lists'
import { execSync } from 'node:child_process'

const branch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }).trim()
const isMain = process.env.IS_RELEASE !== 'true'
const version = execSync('git describe --tags --abbrev=0', { encoding: 'utf-8' }).trim()

const siteUrl = branch === 'main' ? 'https://main.cmp.saghen.dev' : 'https://cmp.saghen.dev'
const otherSiteUrl = branch === 'main' ? 'https://cmp.saghen.dev' : 'https://main.cmp.saghen.dev'
const siteUrl = isMain ? 'https://main.cmp.saghen.dev' : 'https://cmp.saghen.dev'
const otherSiteUrl = isMain ? 'https://cmp.saghen.dev' : 'https://main.cmp.saghen.dev'

const title = branch === 'main' ? 'Main' : version
const otherTitle = branch === 'main' ? version : 'Main'
const title = isMain ? 'Main' : version
const otherTitle = isMain ? version : 'Main'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"build:release": "IS_RELEASE=true vitepress build",
"preview": "vitepress preview"
},
"devDependencies": {
Expand Down

0 comments on commit a80577a

Please sign in to comment.