Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLDR-17803 docs/site: publish to CloudFlare, config updates #3989

Merged
merged 5 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@

name: Publish to gh-pages
name: gh-pages

# Note: we have a foot in two camps here, maybe more
#
# - docs/ldml is the spec, and it gets special handling and generation. Ends up cldr-smoke for now
# - docs/rfc needs to end up somewhere. for now, generate to github.io

# - docs/site is an entire 'site' that gets deployed to what will be cldr.unicode.org
# This is now handled in site.yml

permissions:
pages: write
Expand Down Expand Up @@ -57,7 +65,7 @@ jobs:
with:
ruby-version: 3.2
bundler-cache: true
- name: Build Jekyll part of the site
- name: Build Jekyll part of the site (not spec, not site/)
run: |
gem install bundler github-pages kramdown-parser-gfm # should pull in jekyll, etc.
cd docs && github-pages build && mkdir -vp ../_site/ldml
Expand Down Expand Up @@ -87,6 +95,7 @@ jobs:
rsync -cav --delete-after -e "ssh -o UserKnownHostsFile=${HOME}/.knownhosts -i ${HOME}/.key -p ${CCC_PORT}" ./_site/ ${CCC_USER}@${CCC_HOST}:spec/$(basename ${GITHUB_REF_NAME})/
echo "::endgroup::"
echo "Now go to https://cldr-smoke.unicode.org/spec/"$(basename ${GITHUB_REF_NAME})

deploy:
if: github.repository == 'unicode-org/cldr' && github.event_name == 'push'
environment:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CLDR Site

permissions:
deployments: write
id-token: write
pull-requests: write

on:
pull_request:
paths:
# - "tools/scripts/tr-archive/**"
- "docs/site/**"
- '.github/workflows/site.yml'
push:
branches:
- main
# Only run if docs change.
paths:
# - "tools/scripts/tr-archive/**"
- "docs/site/**"
- '.github/workflows/site.yml'

jobs:
cloudflare:
runs-on: ubuntu-latest
environment: cloudflare
steps:
- uses: actions/checkout@v4
with:
lfs: false
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Setup Jekyll
run: 'gem install bundler jekyll kramdown-parser-gfm webrick'
- name: Build cldr.pages.dev
run: 'cd docs/site && jekyll build'
- name: Pre-install Wrangler
run: npm i -g [email protected]
# see https://github.com/cloudflare/wrangler-action/issues/286
- name: Deploy cldr.pages.dev
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy ./_site --project-name=cldr
- name: Add deploy comment to PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✨ deployed to <${{ steps.deploy.outputs.deployment-url }}>'
})
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Site Update']
})
23 changes: 5 additions & 18 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: CLDR LDML
title: CLDR LDML
# this config file is for NON-spec, NON-site stuff. That is, RFC and ??

name: CLDR LDML Top Matter
title: CLDR LDML Top Matter

markdown: kramdown
input: GFM
Expand All @@ -14,19 +16,4 @@ exclude:
- charts/keyboards/node_modules
- charts/keyboards/node
- ldml

#include:
# - site/

# _config.yml

# everything under 'site' should default to the 'page' layout
defaults:
- scope:
path: 'site'
values:
layout: page

collections:
site:
output: true
- site
21 changes: 21 additions & 0 deletions docs/site/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This is the config file for cldr.unicode.org

name: CLDR Site
title: CLDR Site

markdown: kramdown
input: GFM

destination: ../../_site

# Google Analytics
ga_tracking: UA-7672775-1
ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings

# everything should default to the 'page' layout
defaults:
- scope:
path: ''
values:
layout: page

4 changes: 2 additions & 2 deletions docs/_layouts/page.html → docs/site/_layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<head>
<meta charset="utf-8">
<title>{{ page.title }}</title>
<link rel="stylesheet" href="/site/assets/css/reports-v2.css" />
<link rel="stylesheet" href="/site/assets/css/page.css" />
<link rel="stylesheet" href="/assets/css/reports-v2.css" />
<link rel="stylesheet" href="/assets/css/page.css" />
</head>

<body>
Expand Down
1 change: 1 addition & 0 deletions tools/scripts/web/docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/_site
2 changes: 1 addition & 1 deletion tools/scripts/web/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM jekyll/jekyll
FROM jekyll/jekyll:4.2.2
RUN gem install bundler github-pages kramdown-parser-gfm webrick
8 changes: 7 additions & 1 deletion tools/scripts/web/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Previewing locally
# Docker for CLDR Site

## Previewing locally

1. install https://docker.io
2. `docker compose up`
3. visit <http://127.0.0.1:4000>
4. hit control-C to cancel the docker run.

## Building

1. `docker compose run -w /src site jekyll build`
2. output is in `./_site` here in this dir.
3 changes: 2 additions & 1 deletion tools/scripts/web/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
ports:
- 4000:4000
volumes:
- ../../../../docs:/src
- ../../../../docs/site:/src:rw
- ./_site/:/_site:rw
environment:
- PAGES_REPO_NWO=unicode-org/cldr
Loading