mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-04 23:45:07 +00:00
chore(docs): use gh action to build docs (#8097)
# Which Problems Are Solved This allows us to build multiple docs in parallel and only runs when docs/proto are changed. # Additional Changes - [ ] Change "required" in GitHub from Vercel to the docs flow --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
1374f17c8d
commit
c9e352033e
88
.github/workflows/docsusaurus.yml
vendored
Normal file
88
.github/workflows/docsusaurus.yml
vendored
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
name: Docs
|
||||||
|
env:
|
||||||
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||||
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
Deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
src:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'proto/**'
|
||||||
|
- '.github/workflows/docsusaurus.yml'
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'yarn'
|
||||||
|
cache-dependency-path: docs/yarn.lock
|
||||||
|
- name: Install Vercel CLI
|
||||||
|
run: yarn global add vercel
|
||||||
|
- name: Install Dependencies
|
||||||
|
if: steps.filter.outputs.src == 'true'
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
working-directory: ./docs
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
if: steps.filter.outputs.src == 'true'
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/docs/.docusaurus
|
||||||
|
${{ github.workspace }}/docs/node_modules/.cache
|
||||||
|
key: |
|
||||||
|
${{ runner.os }}-docusaurus-${{ hashFiles('**/package-lock.json', '**/npm-shrinkwrap.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-docusaurus-${{ hashFiles('**/package-lock.json', '**/npm-shrinkwrap.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
${{ runner.os }}-docusaurus-${{ hashFiles('docs/yarn.lock') }}
|
||||||
|
- name: Prepare Preview Environment
|
||||||
|
if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }}
|
||||||
|
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
- name: Perpare Production Environment
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' && steps.filter.outputs.src == 'true' }}
|
||||||
|
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
- name: Build Project Artifacts
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: "--max_old_space_size=8192"
|
||||||
|
if: steps.filter.outputs.src == 'true'
|
||||||
|
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
- name: Deploy Preview
|
||||||
|
if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }}
|
||||||
|
run: |
|
||||||
|
vercel deploy --prebuilt --archive=tgz --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
echo "deploymentUrl=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
|
||||||
|
- name: Deploy Production
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' && steps.filter.outputs.src == 'true'}}
|
||||||
|
run: |
|
||||||
|
vercel deploy --prebuilt --archive=tgz --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
- name: Get Preview URL
|
||||||
|
if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }}
|
||||||
|
id: myRequest
|
||||||
|
uses: fjogeleit/http-request-action@v1
|
||||||
|
with:
|
||||||
|
url: 'https://api.vercel.com/v6/deployments?teamId=${{ secrets.VERCEL_ORG_ID }}&app=docs'
|
||||||
|
method: 'GET'
|
||||||
|
customHeaders: '{"Authorization": "Bearer ${{ secrets.VERCEL_TOKEN }}"}'
|
||||||
|
- uses: cloudposse/github-action-jq@main
|
||||||
|
if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }}
|
||||||
|
id: current
|
||||||
|
with:
|
||||||
|
compact: true
|
||||||
|
raw-output: true
|
||||||
|
input: ${{ steps.myRequest.outputs.response }}
|
||||||
|
script: |-
|
||||||
|
.deployments[] | select(.meta.githubCommitSha == "${{ github.sha }}") | .url
|
||||||
|
- uses: mshick/add-pr-comment@v2
|
||||||
|
if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }}
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
Your build has completed!
|
||||||
|
|
||||||
|
[Preview deployment](https://${{ steps.current.outputs.output }})
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -85,4 +85,5 @@ go.work.sum
|
|||||||
|
|
||||||
load-test/node_modules
|
load-test/node_modules
|
||||||
load-test/yarn-error.log
|
load-test/yarn-error.log
|
||||||
load-test/dist
|
load-test/dist
|
||||||
|
.vercel
|
||||||
|
1
docs/.gitignore
vendored
1
docs/.gitignore
vendored
@ -26,3 +26,4 @@ package-lock.json
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
.vercel
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
## Angular lint workspace and production build
|
|
||||||
FROM node:18 as builder
|
|
||||||
WORKDIR /docs
|
|
||||||
COPY docs/package.json docs/yarn.lock ./
|
|
||||||
RUN yarn install --frozen-lockfile
|
|
||||||
COPY docs .
|
|
||||||
COPY proto /proto
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
## Final image for serving
|
|
||||||
FROM nginx as final
|
|
||||||
COPY docs/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
COPY --from=builder /docs/build /usr/share/nginx/html
|
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
|
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
|
||||||
compact: true
|
compact: auto
|
||||||
};
|
};
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
events {
|
|
||||||
worker_connections 1024; ## Default: 1024
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
|
|
||||||
server {
|
|
||||||
|
|
||||||
listen 8080;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
return 301 /docs;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /docs {
|
|
||||||
alias /usr/share/nginx/html;
|
|
||||||
index /docs/index.html;
|
|
||||||
try_files $uri $uri/ /docs/index.html?q=$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /docs/proxy/js/script.js {
|
|
||||||
proxy_pass https://plausible.io/js/script.js;
|
|
||||||
proxy_set_header Host plausible.io;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /docs/proxy/api/event {
|
|
||||||
proxy_pass https://plausible.io/api/event;
|
|
||||||
proxy_set_header Host plausible.io;
|
|
||||||
proxy_buffering on;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header X-Forwarded-Host $host;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
## enable gzip compression
|
|
||||||
gzip on;
|
|
||||||
gzip_vary on;
|
|
||||||
gzip_min_length 256;
|
|
||||||
gzip_proxied any;
|
|
||||||
|
|
||||||
gzip_types
|
|
||||||
## text/html is always compressed : https://nginx.org/en/docs/http/ngx_http_gzip_module.html
|
|
||||||
text/plain
|
|
||||||
text/css
|
|
||||||
text/javascript
|
|
||||||
application/javascript
|
|
||||||
application/x-javascript
|
|
||||||
application/xml
|
|
||||||
application/json
|
|
||||||
application/ld+json;
|
|
||||||
}
|
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"github": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
"cleanUrls": true,
|
"cleanUrls": true,
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{
|
{
|
||||||
|
@ -2145,7 +2145,7 @@
|
|||||||
"@docusaurus/theme-search-algolia" "2.2.0"
|
"@docusaurus/theme-search-algolia" "2.2.0"
|
||||||
"@docusaurus/types" "2.2.0"
|
"@docusaurus/types" "2.2.0"
|
||||||
|
|
||||||
"@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2":
|
"@docusaurus/react-loadable@5.5.2":
|
||||||
version "5.5.2"
|
version "5.5.2"
|
||||||
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz"
|
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz"
|
||||||
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
||||||
@ -3894,9 +3894,9 @@ caniuse-api@^3.0.0:
|
|||||||
lodash.uniq "^4.5.0"
|
lodash.uniq "^4.5.0"
|
||||||
|
|
||||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001517:
|
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001517:
|
||||||
version "1.0.30001538"
|
version "1.0.30001632"
|
||||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001538.tgz"
|
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz"
|
||||||
integrity sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw==
|
integrity sha512-udx3o7yHJfUxMLkGohMlVHCvFvWmirKh9JAH/d7WOLPetlH+LTL5cocMZ0t7oZx/mdlOWXti97xLZWc8uURRHg==
|
||||||
|
|
||||||
ccount@^1.0.0:
|
ccount@^1.0.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
@ -8546,6 +8546,14 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.10.3"
|
"@babel/runtime" "^7.10.3"
|
||||||
|
|
||||||
|
"react-loadable@npm:@docusaurus/react-loadable@5.5.2":
|
||||||
|
version "5.5.2"
|
||||||
|
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz"
|
||||||
|
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/react" "*"
|
||||||
|
prop-types "^15.6.2"
|
||||||
|
|
||||||
react-magic-dropzone@^1.0.1:
|
react-magic-dropzone@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.npmjs.org/react-magic-dropzone/-/react-magic-dropzone-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/react-magic-dropzone/-/react-magic-dropzone-1.0.1.tgz"
|
||||||
|
Loading…
Reference in New Issue
Block a user