diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..0dca6f10a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +## Version Update + +Select exactly one version update type. This choice is used by CI after the PR is merged into +`main` to update `connect/package.json`, create the release tag, and publish the package to npm. + +- [ ] major +- [ ] minor +- [ ] patch diff --git a/.github/workflows/connect.yml b/.github/workflows/connect.yml deleted file mode 100644 index baff628ea..000000000 --- a/.github/workflows/connect.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: 🧰 Test & Deploy AO Connect - -on: - pull_request: - branches: - - main - paths: - - "connect/**" - push: - branches: - - main - paths: - - "connect/**" - - # Perform a release using a workflow dispatch - workflow_dispatch: - inputs: - version: - description: "semver version to bump to" - required: true - -defaults: - run: - shell: bash - -jobs: - - test: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: πŸ“₯ Download deps - working-directory: connect - run: | - npm i - - - name: ⚑ Run Tests - working-directory: connect - run: | - npm test - env: - CI: true - - test-integration: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: πŸ“₯ Download deps - working-directory: connect - run: | - npm i - - - name: ⚑ Run Tests - working-directory: connect - run: | - npm run test:integration - env: - CI: true - - release: - # Releases are performed via a workflow dispatch - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - concurrency: - group: release - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: "https://registry.npmjs.org" - - - 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: πŸ€“ Set Git User - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: ✊ Bump - id: bump - uses: hyper63/hyper-ci-bump@v2.0.3 - with: - bump-to: ${{ github.event.inputs.version }} - package: connect - - - name: ⬆️ Push - run: | - git push - git push --tags - - - name: πŸ“₯ Download deps - working-directory: connect - run: | - npm i - - - name: 🦠 Publish to NPM - working-directory: connect - run: | - npm run build - npm publish --access=public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/dev-cli.yml b/.github/workflows/dev-cli.yml deleted file mode 100644 index 0cfdd0ffb..000000000 --- a/.github/workflows/dev-cli.yml +++ /dev/null @@ -1,317 +0,0 @@ -name: πŸ‘¨β€πŸ’» Test & Deploy AO CLI - -on: - pull_request: - branches: - - main - paths: - - "dev-cli/**" - push: - branches: - - main - paths: - - "dev-cli/**" - - # Perform a release using a workflow dispatch - workflow_dispatch: - inputs: - version: - description: "semver version to bump to" - required: true - -defaults: - run: - shell: bash - working-directory: dev-cli - -jobs: - # Run only run tests on PRs and pushes to main - test: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - strategy: - matrix: - deno-version: [1.x] - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: πŸ¦• Setup Deno - uses: denoland/setup-deno@v1 - with: - deno-version: ${{ matrix.deno-version }} - - - name: ⚑ Run Tests - run: | - deno task test - env: - CI: true - - test-node-commands: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: πŸ“₯ Download deps - working-directory: dev-cli/container/src/node - run: | - npm i - - - name: ⚑ Run Tests - working-directory: dev-cli/container/src/node - run: | - npm test - env: - CI: true - - release: - # Releases are performed via a workflow dispatch - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - timeout-minutes: 30 - concurrency: - group: release - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: πŸ¦• Setup Deno - uses: denoland/setup-deno@v1 - with: - deno-version: 1.x - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: πŸ“₯ Download deps - working-directory: dev-cli/tools/deploy - run: | - npm i - - - 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" - VER=`deno --version`; echo "deno 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: πŸ”¬ Decode ArNS Wallet JSON File - uses: timheuer/base64-to-file@v1 - id: arns_wallet_file - with: - fileName: arns_wallet.json - encodedString: ${{ secrets.CI_AO_ARNS_WALLET }} - - # The version in the manifest is used to set the version - # displayed for the CI. So we need to update version, - # prior to building the binaries - # - # So we update version here. If CI fails, then that bump is - # never pushed. If it succeeds, the CI will push any changes to the - # manifest, including the version bump, which is what we want - - name: πŸ”Ί Update Version - id: version - run: | - VERSION=$(deno task bump --version=${INPUT_VERSION}) - echo "version=${VERSION}" >> $GITHUB_OUTPUT - env: - INPUT_VERSION: ${{ github.event.inputs.version }} - - - name: πŸ›  Build Binaries - id: build_binaries - run: | - BINARIES_OUTPUT_DIR=$(\ - deno task build-binaries \ - | tail -1 - ) - echo "binaries_output_dir=${BINARIES_OUTPUT_DIR}" >> $GITHUB_OUTPUT - env: - CI: true - - - name: Install ArDrive CLI - run: | - npm i -g ardrive-cli@2 - - - name: πŸ’Ύ Publish Binaries to Arweave - id: publish_binaries - - # - # Use the ArDrive CLI to: - # - create a new folder in the ao CLI Artifacts Drive - # - upload binaries to that folder - # - create a manifest of the folder - # We also add additional tags in order to mint $U - # - run: | - echo "Creating folder for binaries on ArDrive..." - - ARDRIVE_FOLDER_RESULT=$(\ - ardrive create-folder \ - --turbo \ - --parent-folder-id "${ARDRIVE_FOLDER_ID}" \ - --folder-name "${VERSION}" \ - -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 Binaries..." - - ardrive upload-file \ - --turbo \ - --parent-folder-id "${FOLDER_ID}" \ - --local-paths "${BINARIES_OUTPUT_DIR}"/*.zip \ - -w "${WALLET}" - - until [[ $(ardrive list-folder \ - --parent-folder-id "${FOLDER_ID}" \ - | jq 'length') -ge 5 ]]; do - echo "ArDrive folder binaries 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}" - - BINARIES_TRANSACTION_ID=$(\ - echo "${ARDRIVE_MANIFEST_RESULTS}" \ - | jq -r '.created[0].dataTxId' - ) - - echo "folder_id=${FOLDER_ID}" >> $GITHUB_OUTPUT - echo "tx_id=${BINARIES_TRANSACTION_ID}" >> $GITHUB_OUTPUT - env: - WALLET: ${{ steps.wallet_file.outputs.filePath }} - VERSION: ${{ steps.version.outputs.version }} - BINARIES_OUTPUT_DIR: ${{ steps.build_binaries.outputs.binaries_output_dir }} - ARDRIVE_FOLDER_ID: ${{ secrets.CLI_ARDRIVE_FOLDER_ID }} - - - name: πŸ›  Build Install Script - id: build_install_script - run: | - INSTALL_SCRIPT=$(deno task build-install-script --binaries=${BINARIES_TRANSACTION_ID}) - echo "install_script=${INSTALL_SCRIPT}" >> $GITHUB_OUTPUT - env: - CI: true - BINARIES_TRANSACTION_ID: ${{ steps.publish_binaries.outputs.tx_id }} - - # - # Use the ArDrive CLI to: - # - upload the install script to the same folder - # - # Then finally trigger script to update ArNS for install-ao - - name: πŸ›  Publish Install Script to Arweave - id: publish_install - # We output text to stdout, the final line containing - # the url of the transaction. We only need the transaction id - # - # So we tail the output and strip the last part of the printed url - # which should be the transaction id - run: | - echo "Uploading Install Script..." - - ARDRIVE_FILE_RESULTS=$(\ - ardrive upload-file \ - --turbo \ - --parent-folder-id "${FOLDER_ID}" \ - --local-path "${INSTALL_SCRIPT}" \ - -w "${WALLET}" - ) - - echo "${ARDRIVE_FILE_RESULTS}" - - INSTALL_TRANSACTION_ID=$(\ - echo "${ARDRIVE_FILE_RESULTS}" \ - | jq -r '.created[0].dataTxId' - ) - - echo "tx_id=${INSTALL_TRANSACTION_ID}" >> $GITHUB_OUTPUT - env: - WALLET: ${{ steps.wallet_file.outputs.filePath }} - FOLDER_ID: ${{ steps.publish_binaries.outputs.folder_id }} - INSTALL_SCRIPT: ${{ steps.build_install_script.outputs.install_script }} - - - name: Update install_ao ArNS - run: | - echo "Updating install_ao ArNS with new install script tx..." - - INSTALL_SCRIPT_ID="${INSTALL_TRANSACTION_ID}" deno task arns-install-script - env: - # A seprate wallet controls the AO ANT, so we use it to update ArNS - WALLET: ${{ steps.arns_wallet_file.outputs.filePath }} - INSTALL_TRANSACTION_ID: ${{ steps.publish_install.outputs.tx_id }} - - - name: πŸ€“ Set Git User - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - # Until we use something like ArNS, we need a way to keep track of the transactions - # that contain the ao CLI - # - # So we will persist the transaction ids into this file, committed as part of this CI - - name: πŸ—ΊοΈ Update txMappings - run: | - deno task tx-mappings \ - --version=${VERSION} \ - --binaries=${BINARIES_TRANSACTION_ID} \ - --install=${INSTALL_TRANSACTION_ID} \ - --latest - deno fmt deno.json - env: - VERSION: ${{ steps.version.outputs.version }} - BINARIES_TRANSACTION_ID: ${{ steps.publish_binaries.outputs.tx_id }} - INSTALL_TRANSACTION_ID: ${{ steps.publish_install.outputs.tx_id }} - - - name: ⬆️ Push - # We purposefully don't use "--follow-tags" here - # - # Git will push tags in parallel when using '--follow-tags'. - # So if the tip of trunk has changed, this will cause the tag to be pushed, but not the commit. - # - # To get around this, we first attempt to push the commit. If it succeeds, the tag is then pushed. - # If pushing the commit fails, then the step fails and no tag is pushed up, which is what we want. - run: | - git add deno.json src/versions.js - git commit -m "chore(dev-cli): bump version and update txMappings" - git push - git push --tags diff --git a/.github/workflows/loader.yml b/.github/workflows/loader.yml deleted file mode 100644 index 68f062a99..000000000 --- a/.github/workflows/loader.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: ✨ Test & Deploy AO Wasm Loader - -on: - pull_request: - branches: - - main - paths: - - "loader/**" - push: - branches: - - main - paths: - - "loader/**" - - # Perform a release using a workflow dispatch - workflow_dispatch: - inputs: - version: - description: "semver version to bump to" - required: true - -defaults: - run: - shell: bash - -jobs: - test: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 22 - - - name: πŸ“₯ Download deps - working-directory: loader - run: | - npm i - - - name: ⚑ Run Tests - working-directory: loader - run: | - npm test - env: - CI: true - - test-integration: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 22 - - - name: πŸ“₯ Download deps - working-directory: loader - run: | - npm i - - - name: ⚑ Run Tests - working-directory: loader - run: | - npm run test:integration - env: - CI: true - - release: - # Releases are performed via a workflow dispatch - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - concurrency: - group: release - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: "https://registry.npmjs.org" - - - 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: πŸ€“ Set Git User - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: ✊ Bump - id: bump - uses: hyper63/hyper-ci-bump@v2.0.3 - with: - bump-to: ${{ github.event.inputs.version }} - package: loader - - - name: ⬆️ Push - run: | - git push - git push --tags - - - name: πŸ“₯ Download deps - working-directory: loader - run: | - npm i - - - name: 🦠 Publish to NPM - working-directory: loader - run: | - npm run build - npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/protocol-tag-utils.yml b/.github/workflows/protocol-tag-utils.yml deleted file mode 100644 index 97918c0a5..000000000 --- a/.github/workflows/protocol-tag-utils.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: πŸ”–πŸ›  Test & Deploy Protocol Tag Utils - -on: - pull_request: - branches: - - main - paths: - - "protocol-tag-utils/**" - push: - branches: - - main - paths: - - "protocol-tag-utils/**" - - # Perform a release using a workflow dispatch - workflow_dispatch: - inputs: - version: - description: "semver version to bump to" - required: true - -defaults: - run: - shell: bash - -jobs: - - test: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: πŸ“₯ Download deps - working-directory: protocol-tag-utils - run: | - npm i - - - name: ⚑ Run Tests - working-directory: protocol-tag-utils - run: | - npm test - env: - CI: true - - release: - # Releases are performed via a workflow dispatch - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - concurrency: - group: release - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: "https://registry.npmjs.org" - - - 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: πŸ€“ Set Git User - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: ✊ Bump - id: bump - uses: hyper63/hyper-ci-bump@v2.0.3 - with: - bump-to: ${{ github.event.inputs.version }} - package: protocol-tag-utils - - - name: ⬆️ Push - run: | - git push - git push --tags - - - name: πŸ“₯ Download deps - working-directory: protocol-tag-utils - run: | - npm i - - - name: 🦠 Publish to NPM - working-directory: protocol-tag-utils - run: | - npm run build - npm publish --access=public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-npm.yaml b/.github/workflows/publish-npm.yaml new file mode 100644 index 000000000..7d9107aa1 --- /dev/null +++ b/.github/workflows/publish-npm.yaml @@ -0,0 +1,154 @@ +name: Auto Version, Tag, and Publish to NPM + +on: + push: + branches: + - main + workflow_dispatch: + inputs: + update_type: + description: Version update type + required: true + default: patch + type: choice + options: + - major + - minor + - patch + +concurrency: + group: npm-release + cancel-in-progress: false + +jobs: + publish: + if: "${{ github.event_name == 'workflow_dispatch' || !startsWith(github.event.head_commit.message, 'chore: release ') }}" + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + pull-requests: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.DEPLOY_PAT || github.token }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.14.0' + registry-url: 'https://registry.npmjs.org' + + - name: Install npm with OIDC support + run: npm install --global npm@^11.5.1 + + - name: Get version update type + id: release-type + uses: actions/github-script@v7 + with: + script: | + const updateTypes = ['major', 'minor', 'patch']; + + function selectedUpdateTypes(body) { + return updateTypes.filter((type) => { + const pattern = new RegExp(`^- \\[[xX]\\]\\s*${type}\\s*$`, 'im'); + return pattern.test(body ?? ''); + }); + } + + if (context.eventName === 'workflow_dispatch') { + const updateType = context.payload.inputs?.update_type; + + if (!updateTypes.includes(updateType)) { + core.setFailed(`Invalid version update type: ${updateType}`); + return; + } + + core.setOutput('update-type', updateType); + core.info(`Selected version update: ${updateType}`); + return; + } + + const { owner, repo } = context.repo; + const response = await github.rest.repos.listPullRequestsAssociatedWithCommit({ + owner, + repo, + commit_sha: context.sha, + }); + + const pullRequest = + response.data.find((pr) => pr.merged_at && pr.base.ref === 'main') ?? + response.data.find((pr) => pr.merged_at); + + if (!pullRequest) { + core.setFailed(`No merged pull request found for commit ${context.sha}.`); + return; + } + + const selected = selectedUpdateTypes(pullRequest.body); + + if (selected.length !== 1) { + core.setFailed( + `PR #${pullRequest.number} must have exactly one version update checkbox selected. Found ${selected.length}.`, + ); + return; + } + + core.setOutput('update-type', selected[0]); + core.setOutput('pr-number', String(pullRequest.number)); + core.info(`Selected version update from PR #${pullRequest.number}: ${selected[0]}`); + + - name: Bump package version + id: package-version + run: | + npm version "$UPDATE_TYPE" --no-git-tag-version + PACKAGE_NAME=$(node -p "require('./package.json').name") + VERSION=$(node -p "require('./package.json').version") + echo "package-name=$PACKAGE_NAME" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Bumped $PACKAGE_NAME to $VERSION" + working-directory: ./connect + env: + UPDATE_TYPE: ${{ steps.release-type.outputs.update-type }} + + - name: Check release availability + run: | + if git tag --list "v${PACKAGE_VERSION}" | grep -q .; then + echo "::error::Tag v${PACKAGE_VERSION} already exists" + exit 1 + fi + + if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version --registry=https://registry.npmjs.org > /dev/null 2>&1; then + echo "::error::${PACKAGE_NAME}@${PACKAGE_VERSION} already exists on npm" + exit 1 + fi + env: + PACKAGE_NAME: ${{ steps.package-version.outputs.package-name }} + PACKAGE_VERSION: ${{ steps.package-version.outputs.version }} + + - name: Install dependencies + run: npm ci + working-directory: ./connect + + - name: Build package + run: npm run build + working-directory: ./connect + + - name: Commit version bump and tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add connect/package.json connect/package-lock.json + git commit -m "chore: release v${PACKAGE_VERSION} [skip ci]" + git tag "v${PACKAGE_VERSION}" + git push origin HEAD:main + git push origin "v${PACKAGE_VERSION}" + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.version }} + + - name: Publish to NPM + run: npm publish + working-directory: ./connect diff --git a/.github/workflows/scheduler-utils.yml b/.github/workflows/scheduler-utils.yml deleted file mode 100644 index cd3e5874d..000000000 --- a/.github/workflows/scheduler-utils.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: ⏰ Test & Deploy AO Scheduler Utils - -on: - pull_request: - branches: - - main - paths: - - "scheduler-utils/**" - push: - branches: - - main - paths: - - "scheduler-utils/**" - - # Perform a release using a workflow dispatch - workflow_dispatch: - inputs: - version: - description: "semver version to bump to" - required: true - -defaults: - run: - shell: bash - -jobs: - - test: - if: github.event_name != 'workflow_dispatch' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [18.x, 20.x, 22.x] - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: πŸ“₯ Download deps - working-directory: scheduler-utils - run: | - npm i - - - name: ⚑ Run Tests - working-directory: scheduler-utils - run: | - npm test - env: - CI: true - - release: - # Releases are performed via a workflow dispatch - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - concurrency: - group: release - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - - - name: βŽ” Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: "https://registry.npmjs.org" - - - 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: πŸ€“ Set Git User - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: ✊ Bump - id: bump - uses: hyper63/hyper-ci-bump@v2.0.3 - with: - bump-to: ${{ github.event.inputs.version }} - package: scheduler-utils - - - name: ⬆️ Push - run: | - git push - git push --tags - - - name: πŸ“₯ Download deps - working-directory: scheduler-utils - run: | - npm i - - - name: 🦠 Publish to NPM - working-directory: scheduler-utils - run: | - npm run build - npm publish --access=public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/validate-version-selection.yaml b/.github/workflows/validate-version-selection.yaml new file mode 100644 index 000000000..e493b28f9 --- /dev/null +++ b/.github/workflows/validate-version-selection.yaml @@ -0,0 +1,41 @@ +name: Validate Version Selection + +on: + pull_request: + branches: + - main + types: + - opened + - synchronize + - reopened + - edited + - ready_for_review + +permissions: + contents: read + +jobs: + validate-version-selection: + name: Validate version selection + runs-on: ubuntu-latest + + steps: + - name: Validate release checkbox + uses: actions/github-script@v7 + with: + script: | + const body = context.payload.pull_request?.body ?? ''; + const updateTypes = ['major', 'minor', 'patch']; + const selected = updateTypes.filter((type) => { + const pattern = new RegExp(`^- \\[[xX]\\]\\s*${type}\\s*$`, 'im'); + return pattern.test(body); + }); + + if (selected.length !== 1) { + core.setFailed( + `Select exactly one version update checkbox in the PR body. Found ${selected.length}.`, + ); + return; + } + + core.info(`Selected version update: ${selected[0]}`); diff --git a/connect/package.json b/connect/package.json index 2d5112718..d17f6046a 100644 --- a/connect/package.json +++ b/connect/package.json @@ -1,6 +1,6 @@ { "name": "@permaweb/aoconnect", - "version": "0.0.96", + "version": "0.0.97", "repository": { "type": "git", "url": "https://github.com/permaweb/ao.git", diff --git a/connect/src/client/ao-core.js b/connect/src/client/ao-core.js index 0dc8116ee..5f23c85e7 100644 --- a/connect/src/client/ao-core.js +++ b/connect/src/client/ao-core.js @@ -7,7 +7,7 @@ function normalizeOutput(jsonRes) { try { body = typeof jsonRes === 'string' ? JSON.parse(jsonRes?.results?.json?.body) - : jsonRes?.results?.raw ?? {}; + : jsonRes?.raw ?? {}; } catch {} debugLog('info', 'Parsed HyperBEAM Response Body:', body); @@ -166,7 +166,7 @@ export function resultWith(deps) { return async (args) => { try { const params = { - path: `/${args.process}~process@1.0/compute=${args.slot ?? args.message}`, + path: `/${args.process}~process@1.0/compute/results=${args.slot ?? args.message}`, target: args.process, data: getData(args), ...getTags(args), @@ -198,7 +198,7 @@ export function resultsWith(deps) { const currentSlot = await slotResponse.text(); const resultsParams = { - path: `/${args.process}/compute=${currentSlot}`, + path: `/${args.process}/compute/results=${currentSlot}`, ...jsonParams }