-
Notifications
You must be signed in to change notification settings - Fork 1
feat: assemble-docs action #46
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
Merged
Merged
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 c824f3c
feat: add docs version label
ilbertt 88db318
feat: update inputs descriptions
ilbertt 5029509
fix: remove unneeded params
ilbertt 848ba18
feat: use different folder for icp-pages branch
ilbertt e5b37e8
feat: do not push (temporary)
ilbertt 95ca196
feat: push using util
ilbertt 00ce608
feat: temporarily show commit only
ilbertt be75dec
feat: move zips instead of copying them
ilbertt f2c970e
fix: trim output form exec
ilbertt e7a23b3
fix: show last commit diff
ilbertt b5a4048
refactor: use info from github context
ilbertt b1731b1
feat: push branch
ilbertt 965d315
fix: assume icp-pages branch has already been checked out
ilbertt 62c77c0
feat: push after commit and add icp_pages_dir input
ilbertt ac005ed
fix: reverse alphabetical order for versions.json items
ilbertt 1457f3e
refactor: remove unneeded import
ilbertt 1f4ceaa
fix: only upsert versions if stable
ilbertt ac80528
refactor: remove unneeded parameter
ilbertt 20d5cc5
docs: update readme
ilbertt cf5869e
fix: do not push if there are no changes
ilbertt 281a551
refactor: latest_version_label
ilbertt d1be080
chore: update readme
ilbertt 3545255
fix: build action
ilbertt 8a4d19c
Merge remote-tracking branch 'origin/main' into luca/assemble-docs-ac…
ilbertt fb88d8b
refactor: use utils
ilbertt 7ae6029
Update actions/assemble-docs/README.md
ilbertt aa4753c
docs: fix comment
ilbertt e386a58
refactor: simplify inputs
ilbertt 79fd96b
fix: regex and check build
ilbertt 4aaa377
refactor: add logs
ilbertt 9fcb545
fix: zip dest path
ilbertt bcb6f51
Merge remote-tracking branch 'origin/main' into luca/assemble-docs-ac…
ilbertt e10583f
fix: remove todo
ilbertt bfca2ef
fix: update inputs
ilbertt 924f1cc
fix: zip in folder
ilbertt 9220ef5
fix: delete zip before zipping again
ilbertt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
|
|
||
| # Checkout a dedicated branch where to push the assembled docs | ||
| - name: Checkout icp-pages branch | ||
|
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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.