Skip to content
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
28 changes: 16 additions & 12 deletions .github/workflows/deploy-bundle-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 21.6.1
node-version-file: .nvmrc

- name: Validate Branch Names
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref || github.ref_name }}
run: |
# Check if branch names contain invalid characters. Only alphanumeric, _, -, ., and / are allowed.
validate_branch_name() {
Expand All @@ -34,10 +36,12 @@ jobs:
exit 1
fi
}
validate_branch_name "${{ github.event.pull_request.head.ref || github.ref_name }}"
validate_branch_name "$BRANCH_NAME"

- name: Extract Branch Names
id: extract_branch
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref || github.ref_name }}
run: |
# Extract and transform branch names
extract_branch() {
Expand All @@ -53,7 +57,7 @@ jobs:
}

# Transform branch names in form of `refs/heads/main` to `main`
draft_branch=$(extract_branch "${{ github.event.pull_request.head.ref || github.ref_name }}")
draft_branch=$(extract_branch "$BRANCH_NAME")

# Replace / with - in the draft branch name to use as a directory name
draft_directory=$(echo "$draft_branch" | tr / -)
Expand All @@ -77,8 +81,8 @@ jobs:
if: success()
run: |
set -o pipefail
gulp lint |& tee $GITHUB_WORKSPACE/build.log
gulp preview:build |& tee $GITHUB_WORKSPACE/build.log
npx gulp lint |& tee $GITHUB_WORKSPACE/build.log
npx gulp preview:build |& tee $GITHUB_WORKSPACE/build.log
env:
NO_COLOR: 1

Expand All @@ -103,15 +107,15 @@ jobs:

- name: Create Build Success Comment
if: ${{ success() && github.event.pull_request.number }}
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
body: "${{ env.BUILD_SUCCESS_COMMENT }}"
reactions: rocket

- name: Create Build Failure Comment
if: ${{ failure() && github.event.pull_request.number }}
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Expand All @@ -122,7 +126,7 @@ jobs:
- name: Find Comment
id: fc
if: ${{ success() && github.event.pull_request.number }}
uses: peter-evans/find-comment@v3
uses: peter-evans/find-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: UI bundle preview build successful!
Expand Down Expand Up @@ -191,15 +195,15 @@ jobs:

- name: Update Comment
if: ${{ steps.fc.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Deploy successful! [View preview](${{ steps.draft_url.outputs.url }})
reactions: hooray

- name: Upload Deploy Log
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: always()
with:
name: deploy.log
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-ui-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
credentials: https://${{ secrets.DOCS_GITHUB_PAT }}@github.com

- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0 # fetch tags too

Expand All @@ -34,9 +34,9 @@ jobs:

- name: Setup Node.js
if: ${{ steps.skip_release.outputs.skip_release == '' }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 21.6.1
node-version-file: .nvmrc

- name: Install Dependencies
if: ${{ steps.skip_release.outputs.skip_release == '' }}
Expand All @@ -46,7 +46,7 @@ jobs:
if: ${{ steps.skip_release.outputs.skip_release == '' }}
run: |
set -o pipefail
gulp bundle |& tee $GITHUB_WORKSPACE/build.log
npx gulp bundle |& tee $GITHUB_WORKSPACE/build.log

- name: Get Last Release Number
id: get_last_release_number
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.20.2
24
31 changes: 20 additions & 11 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
= DataStax Docs UI
// Variables:
:current-release:
// The major version of Node.js in .nvmrc
:nodejs-version: 24
// Settings:
:!example-caption:
:experimental:
Expand Down Expand Up @@ -95,7 +97,7 @@ A more comprehensive tutorial can be found in the documentation at {url-antora-u
To preview and bundle the UI, you need the following software on your computer:

* {url-git}[git] (command: `git`)
* {url-nodejs}[Node.js] (commands: `node` and `npm`)
* {url-nodejs}[Node.js] {nodejs-version} (commands: `node` and `npm`)
* {url-gulp}[Gulp CLI] (command: `gulp`)

==== git
Expand All @@ -119,30 +121,33 @@ node --version
----

If this command fails with an error, you don't have Node.js installed.
If the command doesn't report an https://nodejs.org/en[LTS version] of Node.js, it means you don't have a suitable version of Node.js installed.
This project uses Node.js {nodejs-version}, which is set in its [.path]_.nvmrc_ file and is also what its GitHub Actions workflows use.
If the command reports a different major version, you don't have a suitable version of Node.js installed.

While you can install Node.js from the official packages, we strongly recommend that you use {url-nvm}[nvm] (Node Version Manager) to manage your Node.js installation(s).
Follow the {url-nvm-install}[nvm installation instructions] to set up nvm on your machine.

Once you've installed nvm, open a new terminal and install Node.js LTS using the following command:
Once you've installed nvm, open a new terminal and install Node.js {nodejs-version} using the following command:

[source,shell]
[source,shell,subs=attributes+]
----
nvm install --lts
nvm install {nodejs-version}
----

You can switch to this version of Node.js at any time using the following command:

[source,shell]
[source,shell,subs=attributes+]
----
nvm use --lts
nvm use {nodejs-version}
----

To make Node.js LTS the default in new terminals, type:
In the project folder, you can leave out the version (`nvm install` or `nvm use`), and nvm reads it from [.path]_.nvmrc_.

[source,shell]
To make Node.js {nodejs-version} the default in new terminals, type:

[source,shell,subs=attributes+]
----
nvm alias default node
nvm alias default {nodejs-version}
----

Now that you have Node.js installed, you can proceed with installing the Gulp CLI.
Expand All @@ -159,6 +164,9 @@ You can install the Gulp CLI globally (which resolves to a location in your user
npm install -g gulp-cli
----

nvm keeps globally installed packages separate for each version of Node.js.
When you start using another version, such as when this project moves to a newer one, run this command again with that version active, or the `gulp` command fails with `command not found`.

Verify the Gulp CLI is installed and on your PATH by running:

[source,shell]
Expand All @@ -173,7 +181,8 @@ If you prefer to install global packages using Yarn, run this command instead:
yarn global add gulp-cli
----

Alternately, you can use the `gulp` command that is installed by the project's dependencies.
Alternately, you can skip the global install and use the `gulp` command that the project's dependencies provide, which keeps working when you switch versions of Node.js.
Once you've installed the project's dependencies, put `npx` in front of the `gulp` commands in this guide, as in the following command (the GitHub Actions workflows run Gulp this way):

[source,shell]
----
Expand Down
8 changes: 1 addition & 7 deletions gulp.d/tasks/build-preview-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ const yaml = require('js-yaml')

const ASCIIDOC_ATTRIBUTES = { experimental: '', icons: 'font', sectanchors: '', 'source-highlighter': 'highlight.js' }

const algoliaTestKeys = {
algoliaAppId: 'R2IYF7ETH7',
algoliaIndexName: 'docsearch',
algoliaApiKey: '599cec31baffa4868cae4e79f180729b',
}

module.exports = (src, previewSrc, previewDest, sink = () => map()) => (done) =>
Promise.all([
loadSampleUiModel(previewSrc),
Expand All @@ -43,7 +37,7 @@ module.exports = (src, previewSrc, previewDest, sink = () => map()) => (done) =>
for (const component of baseUiModel.site.components) {
for (const version of component.versions || []) version.asciidoc = asciidoc
}
baseUiModel = { ...baseUiModel, env: process.env, site: { ...baseUiModel.site, keys: algoliaTestKeys } }
baseUiModel = { ...baseUiModel, env: process.env }
delete baseUiModel.asciidoc
return [baseUiModel, layouts]
})
Expand Down
Loading
Loading