also looking at this
fix(docs): deploy corrected active tabs
#81
6 files
+64
-5
| @@ -1,5 +1,5 @@ | ||
| 1 | import type { BunPressOptions } from '../src/types' | |
| 2 | import { defaultConfig } from '../src/config' | |
| 1 | import type { BunPressOptions } from '../packages/bunpress/src/types' | |
| 2 | import { defaultConfig } from '../packages/bunpress/src/config' | |
| 3 | 3 | |
| 4 | 4 | const config: BunPressOptions = { |
| 5 | 5 | ...defaultConfig, |
| @@ -106,3 +106,54 @@ jobs: | ||
| 106 | 106 | run: pantry publish:commit './packages/*' |
| 107 | 107 | env: |
| 108 | 108 | PANTRY_REGISTRY_TOKEN: ${{ secrets.PANTRY_TOKEN }} |
| 109 | ||
| 110 | deploy-docs: | |
| 111 | name: deploy bunpress.org | |
| 112 | needs: [lint, typecheck, test] | |
| 113 | if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| 114 | runs-on: ubuntu-latest | |
| 115 | concurrency: | |
| 116 | group: bunpress-org-production | |
| 117 | cancel-in-progress: false | |
| 118 | env: | |
| 119 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| 120 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| 121 | AWS_DEFAULT_REGION: us-east-1 | |
| 122 | ||
| 123 | steps: | |
| 124 | - uses: actions/checkout@v6 | |
| 125 | ||
| 126 | - name: Setup Pantry | |
| 127 | uses: pantry-pm/pantry/packages/action@9f797da1ed073df7839cb6a9a7db6181ba33f0b7 | |
| 128 | with: | |
| 129 | version: 0.11.12 | |
| 130 | packages: bun.sh@1.3.14 | |
| 131 | install: 'false' | |
| 132 | ||
| 133 | - name: Install dependencies | |
| 134 | run: bun install --frozen-lockfile | |
| 135 | ||
| 136 | - name: Build documentation | |
| 137 | run: bun run build:docs | |
| 138 | ||
| 139 | - name: Publish site and invalidate CloudFront | |
| 140 | shell: bash | |
| 141 | run: | | |
| 142 | set -euo pipefail | |
| 143 | ||
| 144 | distribution_id="$( | |
| 145 | aws cloudfront list-distributions --output json \ | |
| 146 | | jq -r '[.DistributionList.Items[] | select((.Aliases.Items // []) | index("bunpress.org")) | .Id][0] // empty' | |
| 147 | )" | |
| 148 | ||
| 149 | if [[ -z "$distribution_id" ]]; then | |
| 150 | echo "Could not find the CloudFront distribution for bunpress.org." >&2 | |
| 151 | exit 1 | |
| 152 | fi | |
| 153 | ||
| 154 | aws s3 sync dist/.bunpress s3://bunpress-org \ | |
| 155 | --delete \ | |
| 156 | --cache-control 'max-age=3600, public' | |
| 157 | aws cloudfront create-invalidation \ | |
| 158 | --distribution-id "$distribution_id" \ | |
| 159 | --paths '/*' | |
| @@ -333,7 +333,7 @@ const varsCSS = `/** | ||
| 333 | 333 | --bp-code-tab-text-color: var(--bp-c-text-2); |
| 334 | 334 | --bp-code-tab-bg: var(--bp-code-block-bg); |
| 335 | 335 | --bp-code-tab-hover-text-color: var(--bp-c-text-1); |
| 336 | --bp-code-tab-active-text-color: var(--bp-c-text-1); | |
| 336 | --bp-code-tab-active-text-color: var(--bp-c-brand-1); | |
| 337 | 337 | --bp-code-tab-active-bar-color: var(--bp-c-brand-1); |
| 338 | 338 | } |
| 339 | 339 | |
| @@ -304,7 +304,7 @@ const varsCSS = `/** | ||
| 304 | 304 | --bp-code-tab-text-color: var(--bp-c-text-2); |
| 305 | 305 | --bp-code-tab-bg: var(--bp-code-block-bg); |
| 306 | 306 | --bp-code-tab-hover-text-color: var(--bp-c-text-1); |
| 307 | --bp-code-tab-active-text-color: var(--bp-c-text-1); | |
| 307 | --bp-code-tab-active-text-color: var(--bp-c-brand-1); | |
| 308 | 308 | --bp-code-tab-active-bar-color: var(--bp-c-brand-1); |
| 309 | 309 | } |
| 310 | 310 | |
| @@ -285,7 +285,7 @@ | ||
| 285 | 285 | --vp-code-tab-text-color: var(--vp-c-text-2); |
| 286 | 286 | --vp-code-tab-bg: var(--vp-code-block-bg); |
| 287 | 287 | --vp-code-tab-hover-text-color: var(--vp-c-text-1); |
| 288 | --vp-code-tab-active-text-color: var(--vp-c-text-1); | |
| 288 | --vp-code-tab-active-text-color: var(--vp-c-brand-1); | |
| 289 | 289 | --vp-code-tab-active-bar-color: var(--vp-c-brand-1); |
| 290 | 290 | } |
| 291 | 291 | |
| @@ -61,4 +61,12 @@ describe('themeConfig to CSS', () => { | ||
| 61 | 61 | |
| 62 | 62 | expect(html).not.toContain('--bp-c-brand-1: #') |
| 63 | 63 | }) |
| 64 | ||
| 65 | it('renders one branded active-tab treatment', async () => { | |
| 66 | const html = await render(BASE) | |
| 67 | ||
| 68 | expect(html.match(/\.code-group-tab\.active\s*\{/g)).toHaveLength(1) | |
| 69 | expect(html).toContain('--bp-code-tab-active-text-color: var(--bp-c-brand-1);') | |
| 70 | expect(html).not.toContain('border-bottom-color: #3451b2;') | |
| 71 | }) | |
| 64 | 72 | }) |