Skip to content

Merge pull request #227 from Jonny-Ringo/patch-5 #425

Merge pull request #227 from Jonny-Ringo/patch-5

Merge pull request #227 from Jonny-Ringo/patch-5 #425

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: 22
cache: yarn
- name: πŸ“₯ Download deps
run: |
yarn --ignore-engines
- 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: 22
cache: yarn
- name: πŸ“₯ Download deps
run: |
yarn --ignore-engines
- 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: πŸ›  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: πŸ’Ύ Publish to Arweave
id: publish_artifacts
run: |
npx permaweb-deploy \
--ant-process=${ANT_PROCESS} \
--undername=${UNDERNAME} \
--deploy-folder=${ARTIFACTS_OUTPUT_DIR}
env:
DEPLOY_KEY: ${{ secrets.CI_WALLET }}
ARTIFACTS_HASH: ${{ steps.build_artifacts.outputs.artifacts_hash }}
ARTIFACTS_OUTPUT_DIR: ${{ steps.build_artifacts.outputs.artifacts_output_dir }}
ANT_PROCESS: YFbfeqZMbPVGFjQ-PHJY-Y99JQu7O3Jdet06pJnD5iI
UNDERNAME: cookbook