Skip to content

fix: broken link

fix: broken link #362

Workflow file for this run

name: πŸ₯˜ Build & Deploy Cookbook
on:
pull_request:
branches:
- main
paths:
- "src/**"
push:
branches:
- main
paths:
- "src/**"
# Perform a release using a workflow dispatch
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
# Run the build as part of PRs to confirm the site properly builds
check_build:
if: ${{ startsWith(github.ref, 'refs/pull/') }}
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: βŽ” Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- name: πŸ“₯ Download deps
run: |
yarn
- name: πŸ›  Build Docs
run: |
yarn build
# Build and deploy the artifacts to Arweave via ArDrive
deploy:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these deployments to complete.
concurrency:
group: deploy
cancel-in-progress: false
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: βŽ” Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- name: πŸ“₯ Download deps
run: |
yarn
- name: πŸ‘€ Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`node --version`; echo "Node ver: $VER"
VER=`npm --version`; echo "npm ver: $VER"
- name: πŸ”¬ Decode Wallet JSON File
uses: timheuer/base64-to-file@v1
id: wallet_file
with:
fileName: wallet.json
encodedString: ${{ secrets.CI_WALLET }}
- name: πŸ›  Build Docs
id: build_artifacts
run: |
yarn build
touch src/.vitepress/dist/.nojekyll
ARTIFACTS_HASH=$(sha256sum src/.vitepress/dist/hashmap.json | awk '{ print $1 }')
echo "artifacts_output_dir=src/.vitepress/dist" >> $GITHUB_OUTPUT
echo "artifacts_hash=${ARTIFACTS_HASH}" >> $GITHUB_OUTPUT
- name: Install ArDrive CLI
run: |
npm i -g ardrive-cli@2
- name: πŸ’Ύ Publish to Arweave
id: publish_artifacts
#
# Use the ArDrive CLI to:
# - create a new folder in the ao Cookbook Artifacts Drive
# - upload artifacts to that folder
# - create a manifest of the folder
#
run: |
echo "Creating folder for artifacts on ArDrive..."
ARDRIVE_FOLDER_RESULT=$(\
ardrive create-folder \
--turbo \
--parent-folder-id "${ARDRIVE_FOLDER_ID}" \
--folder-name "${ARTIFACTS_HASH}" \
-w "${WALLET}"
)
echo "${ARDRIVE_FOLDER_RESULT}"
FOLDER_ID=$(\
echo "${ARDRIVE_FOLDER_RESULT}" \
| jq -r '.created[0].entityId'
)
until ardrive folder-info \
--folder-id \
"${FOLDER_ID}"; do
echo "ArDrive folder has not yet synced. Sleeping for 2 seconds..."
sleep 2
done
echo "Uploading Artifacts..."
ardrive upload-file \
--turbo \
--parent-folder-id "${FOLDER_ID}" \
--local-paths "${ARTIFACTS_OUTPUT_DIR}"/* \
-w "${WALLET}"
until [[ $(ardrive list-folder \
--parent-folder-id "${FOLDER_ID}" \
| jq 'length') -gt 0 ]]; do
echo "ArDrive folder artifacts have not yet synced. Sleeping for 2 seconds..."
sleep 2
done
echo "Generating Manifest..."
ARDRIVE_MANIFEST_RESULTS=$(\
ardrive create-manifest \
--turbo \
-f "${FOLDER_ID}" \
-w "${WALLET}"
)
echo "${ARDRIVE_MANIFEST_RESULTS}"
MANIFEST_TRANSACTION_ID=$(\
echo "${ARDRIVE_MANIFEST_RESULTS}" \
| jq -r '.created[0].dataTxId'
)
echo "Updating ArNS for cookbook_ao..."
MANIFEST_ID="${MANIFEST_TRANSACTION_ID}" npm run arns
env:
WALLET: ${{ steps.wallet_file.outputs.filePath }}
ARTIFACTS_HASH: ${{ steps.build_artifacts.outputs.artifacts_hash }}
ARTIFACTS_OUTPUT_DIR: ${{ steps.build_artifacts.outputs.artifacts_output_dir }}
ARDRIVE_FOLDER_ID: ${{ secrets.CLI_ARDRIVE_FOLDER_ID }}
LOCAL_MANIFEST: DriveManifest.json
THEME_TX_ID: x5iNUndl8l2SgSAjv0Pt8HvvdBvuswLU0huES3_AF-c
FRAMEWORK_TX_ID: rER7ZqcQSoTR9vjcHuq0bIqLMO1PfcQ06KQTF5HmRkM