Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b36603f
feat: assemble-docs action
ilbertt Aug 8, 2025
c824f3c
feat: add docs version label
ilbertt Aug 8, 2025
88db318
feat: update inputs descriptions
ilbertt Aug 8, 2025
5029509
fix: remove unneeded params
ilbertt Aug 8, 2025
848ba18
feat: use different folder for icp-pages branch
ilbertt Aug 11, 2025
e5b37e8
feat: do not push (temporary)
ilbertt Aug 11, 2025
95ca196
feat: push using util
ilbertt Aug 11, 2025
00ce608
feat: temporarily show commit only
ilbertt Aug 11, 2025
be75dec
feat: move zips instead of copying them
ilbertt Aug 11, 2025
f2c970e
fix: trim output form exec
ilbertt Aug 11, 2025
e7a23b3
fix: show last commit diff
ilbertt Aug 11, 2025
b5a4048
refactor: use info from github context
ilbertt Aug 11, 2025
b1731b1
feat: push branch
ilbertt Aug 11, 2025
965d315
fix: assume icp-pages branch has already been checked out
ilbertt Aug 11, 2025
62c77c0
feat: push after commit and add icp_pages_dir input
ilbertt Aug 11, 2025
ac005ed
fix: reverse alphabetical order for versions.json items
ilbertt Aug 11, 2025
1457f3e
refactor: remove unneeded import
ilbertt Aug 11, 2025
1f4ceaa
fix: only upsert versions if stable
ilbertt Aug 11, 2025
ac80528
refactor: remove unneeded parameter
ilbertt Aug 11, 2025
20d5cc5
docs: update readme
ilbertt Aug 11, 2025
cf5869e
fix: do not push if there are no changes
ilbertt Aug 11, 2025
281a551
refactor: latest_version_label
ilbertt Aug 12, 2025
d1be080
chore: update readme
ilbertt Aug 12, 2025
3545255
fix: build action
ilbertt Aug 12, 2025
8a4d19c
Merge remote-tracking branch 'origin/main' into luca/assemble-docs-ac…
ilbertt Aug 13, 2025
fb88d8b
refactor: use utils
ilbertt Aug 13, 2025
7ae6029
Update actions/assemble-docs/README.md
ilbertt Aug 13, 2025
aa4753c
docs: fix comment
ilbertt Aug 13, 2025
e386a58
refactor: simplify inputs
ilbertt Aug 13, 2025
79fd96b
fix: regex and check build
ilbertt Aug 13, 2025
4aaa377
refactor: add logs
ilbertt Aug 13, 2025
9fcb545
fix: zip dest path
ilbertt Aug 13, 2025
bcb6f51
Merge remote-tracking branch 'origin/main' into luca/assemble-docs-ac…
ilbertt Aug 13, 2025
e10583f
fix: remove todo
ilbertt Aug 13, 2025
bfca2ef
fix: update inputs
ilbertt Aug 13, 2025
924f1cc
fix: zip in folder
ilbertt Aug 13, 2025
9220ef5
fix: delete zip before zipping again
ilbertt Aug 13, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/self-check-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
action_name: ['create-pr']
action_name: ['create-pr', 'assemble-docs', 'submit-docs']
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
69 changes: 69 additions & 0 deletions actions/assemble-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Assemble docs action

This action packages documentation assets for a specific version and updates the `versions.json` file on the `icp-pages` branch. It is typically used in conjunction with the [submit-docs](../submit-docs/README.md) action.

This action:

- Zips the `assets_dir` directory into `{target_dir}/{version}.zip`
- Upserts the entry to `versions.json` for the `version`

## Action inputs

| Input | Description | Default |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `assets_dir` | Path to the directory containing the documentation assets to be assembled. | _required_ |
| `version` | The subpath at which the assembled docs will be published. Allowed values: `vX` , `vX.Y` , `vX.Y.Z` , `latest` , `beta` , `dev` , `next` , `nightly` , `canary`. | _required_ |
| `version_label` | Optional label value to set for this version's option in the website sidebar version dropdown. | `{inputs.version}` |
| `target_dir` | The folder where the assembled docs must be saved. | _required_ |

## Example usage

```yaml
name: Publish docs

on:
workflow_dispatch:

jobs:
publish_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Create GitHub App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: generate_token
with:
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }}
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }}
owner: dfinity
repo: icp-js-sdk-docs

# Add your own steps to build doc assets and output them to dist/docs/v1.2.3
# (and optionally dist/docs/latest if you want to publish docs under the latest URL)
Comment thread
nathanosdev marked this conversation as resolved.

# Checkout a dedicated branch where to push the assembled docs
- name: Checkout icp-pages branch
Comment thread
ilbertt marked this conversation as resolved.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: icp-pages
path: icp-pages

- name: Assemble docs
uses: dfinity/ci-tools/actions/assemble-docs@main
with:
assets_dir: dist/docs/v1.2.3
target_dir: icp-pages # must match the `path` in the checkout step
version: v1.2.3
version_label: 'Version 1.2.3'

- name: Submit docs
uses: dfinity/ci-tools/actions/submit-docs@main
with:
destination_repo: dfinity/icp-js-sdk-docs
event_type: submit-project-docs
token: ${{ secrets.GITHUB_TOKEN }}
target_dir: icp-pages # must match the `path` in the checkout step
target_branch: icp-pages # must match the `ref` in the checkout step
```
20 changes: 20 additions & 0 deletions actions/assemble-docs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Assemble docs
description: 'Zips documentation folders and updates versions.json on the icp-pages branch.'

inputs:
assets_dir:
description: 'Path to the directory containing the documentation assets to be assembled.'
required: true
version:
description: 'The subpath at which the assembled docs will be published. Allowed values: `vX` | `vX.Y` | `vX.Y.Z` | `latest` | `beta` | `dev` | `next` | `nightly` | `canary`.'
required: true
version_label:
description: "Optional label value to set for this version's option in the website sidebar version dropdown. Defaults to the value of the `version` input."
required: false
target_dir:
description: 'The folder where the assembled docs must be saved.'
required: true

runs:
using: node20
main: dist/index.js
10 changes: 10 additions & 0 deletions actions/assemble-docs/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as esbuild from 'esbuild';
import path from 'node:path';

await esbuild.build({
entryPoints: [path.resolve(import.meta.dirname, 'src', 'index.ts')],
outfile: path.resolve(import.meta.dirname, 'dist', 'index.js'),
bundle: true,
platform: 'node',
target: 'node20',
});
Loading