-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add packs caching solution DOC-1460 (#4632)
* docs: add caching solution DOC-1460 * docs: add upload logic DOC-1460 * docs: update upload artifact DOC-1460 * docs: update build steps * docs: update download logic * docs: fix folder name * docs: fix folder path * docs: add composite action that builds cached packs DOC-1460 * docs: fix composite action reference * docs: fix composite action path * docs: fix composite action shell DOC-1460 * docs: add missing shell * docs: add failure condition * docs: create static/img/packs * docs: fix broken action * docs: add local workflow script * docs: add exit code handling DOC-1460 * ci: auto-formatting prettier issues * docs: add api-repositories-response to clean-packs * docs: add error handling to writeFile * docs: remove plugin from asset and add async file write function * docs: add directory creation to writeResponseFile * docs: remove push condition from post release * docs: add push condition from post release * docs: change name of workflow * docs: add readme documentation * ci: auto-formatting prettier issues * docs: fix reading of exit code * docs: remove the true on npm run build * docs: disable automatic failure to allow the exit code to be set * docs: add intermediary step * docs: adjust workflow * docs: adjust workflow with failure * docs: remove fail condition * docs: remove intermediary step * docs: add caching in other workflows * docs: add extra context in readme * docs: place make build commands back * docs: add build-ci job * docs: adjust the make commands DOC-1460 * docs: remove spaces * docs: remove spaces * docs: update readme * docs: remove clear from build-ci * docs: replace clear and change action * docs: add exit codes section in the readme * docs: add conditional around jq install --------- Co-authored-by: Carolina Delwing Rosa <[email protected]> Co-authored-by: addetz <[email protected]>
- Loading branch information
1 parent
9e5cfe1
commit 2227097
Showing
14 changed files
with
406 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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,48 @@ | ||
name: "Build with cached packs" | ||
inputs: | ||
gh-token: | ||
description: "GitHub Token for authentication" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install jq (JSON processor) if not found | ||
run: | | ||
if ! command -v jq &> /dev/null; then | ||
sudo apt-get update | ||
sudo apt-get install -y jq | ||
else | ||
echo "jq is already installed. Skipping install..." | ||
fi | ||
shell: bash | ||
|
||
- name: Download Packs Data | ||
run: | | ||
# Find the latest packs upload workflow. | ||
run_id=$(gh run list --workflow="post_release.yaml" --limit 1 --json databaseId | jq -r '.[0].databaseId') | ||
# Remove any downloaded artifacts, should they exist. | ||
rm -rf ./downloaded_artifacts | ||
# Download the latest artifact to a new dir. | ||
gh run download ${run_id} --name build-packs --dir ./downloaded_artifacts | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ inputs.gh-token }} | ||
|
||
- name: Unpack packs data | ||
run: | | ||
# Ensure the correct folders exist. | ||
mkdir -p .docusaurus/packs-integrations | ||
# Move the files to their correct places in the checked out repository | ||
mv downloaded_artifacts/.docusaurus/packs-integrations/* .docusaurus/packs-integrations | ||
mkdir -p static/img/packs | ||
mv downloaded_artifacts/build/packs/* static/img/packs | ||
# Clean up. | ||
rm -rf downloaded_artifacts | ||
shell: bash | ||
|
||
- name: Build | ||
run: | | ||
rm -rf build | ||
npm run build | ||
shell: bash |
This file contains 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 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 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,59 @@ | ||
name: Post Release Processing | ||
# This workflow is triggered when a workflow run of the "Release to Production" workflow is completed or when manually triggered. | ||
# The primary purpose of this workflow is to build the site, copy the packs data and upload it as artifacts. | ||
# The packs data can be used as a fallback when the Palette API cannot return a packs list. | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Release to Production"] | ||
types: [completed] | ||
workflow_dispatch: | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FULLSTORY_ORGID: ${{ secrets.FULLSTORY_ORGID }} | ||
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} | ||
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | ||
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }} | ||
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }} | ||
PALETTE_API_KEY: ${{ secrets.PALETTE_API_KEY }} | ||
DISABLE_PACKS_INTEGRATIONS: ${{ secrets.DISABLE_PACKS_INTEGRATIONS }} | ||
|
||
jobs: | ||
|
||
create-assets: | ||
name: asset-builds | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js Environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "npm" | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: | | ||
touch .env | ||
make build-ci | ||
- name: Build with cached packs | ||
if: ${{ env.BUILD_EXIT_CODE == '5' }} | ||
uses: ./.github/actions/build-cached-packs | ||
with: | ||
gh-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload Build Packs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "build-packs" | ||
path: | | ||
build/packs | ||
.docusaurus/packs-integrations | ||
if-no-files-found: error | ||
retention-days: 7 |
This file contains 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 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 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 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 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 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 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
Oops, something went wrong.