From 304ffd434e7f260feb83bcf7c9f8158d8dbe40d6 Mon Sep 17 00:00:00 2001 From: Shurtu-gal Date: Sat, 14 Nov 2026 23:04:54 +0530 Subject: [PATCH 1/2] fix: repair release assets and action image builds --- .../workflows/deploy/chocolatey/replace.ps1 | 4 +- .../chocolatey/tools/chocolateyinstall.ps1 | 8 +- .github/workflows/release-chocolatey.yml | 13 +- .github/workflows/release-docker.yml | 121 ++++++++++++++---- .github/workflows/upload-release-assets.yml | 19 +-- docs/installation.md | 2 +- github-action/Dockerfile | 4 +- package.json | 4 +- scripts/releasePackagesRename.js | 2 +- 9 files changed, 117 insertions(+), 60 deletions(-) diff --git a/.github/workflows/deploy/chocolatey/replace.ps1 b/.github/workflows/deploy/chocolatey/replace.ps1 index c92cc866b..fb9a59578 100644 --- a/.github/workflows/deploy/chocolatey/replace.ps1 +++ b/.github/workflows/deploy/chocolatey/replace.ps1 @@ -1,7 +1,6 @@ param ( [Parameter(Mandatory=$true)] [string]$version, - [string]$checksum, [string]$checksum64 ) @@ -13,7 +12,6 @@ $filePaths = @( foreach ($filePath in $filePaths) { $fileContents = Get-Content $filePath $fileContents = $fileContents -replace '{{version}}', $version - $fileContents = $fileContents -replace '{{checksum}}', $checksum $fileContents = $fileContents -replace '{{checksum64}}', $checksum64 Set-Content $filePath $fileContents -} \ No newline at end of file +} diff --git a/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 b/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 index 51049d731..afb122d05 100644 --- a/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 +++ b/.github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1 @@ -1,21 +1,21 @@ $ErrorActionPreference = 'Stop' # stop on all errors $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -$url = 'https://github.com/asyncapi/cli/releases/download/v{{version}}/asyncapi.x86.exe' +if (-not [Environment]::Is64BitOperatingSystem) { + throw 'AsyncAPI CLI requires 64-bit Windows.' +} + $url64 = 'https://github.com/asyncapi/cli/releases/download/v{{version}}/asyncapi.x64.exe' $packageArgs = @{ packageName = $env:ChocolateyPackageName unzipLocation = $toolsDir fileType = 'EXE' - url = $url url64bit = $url64 #file = $fileLocation NOTE: Commented out because we are using url instead softwareName = 'asyncapi-cli*' - checksum = '{{checksum}}' - checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512 checksum64 = '{{checksum64}}' checksumType64= 'sha256' #default is checksumType diff --git a/.github/workflows/release-chocolatey.yml b/.github/workflows/release-chocolatey.yml index 1a74c5025..dc6adc045 100644 --- a/.github/workflows/release-chocolatey.yml +++ b/.github/workflows/release-chocolatey.yml @@ -17,7 +17,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set Version id: release_version @@ -59,17 +59,14 @@ jobs: run: | echo "Downloading release assets for version ${{ steps.release_version.outputs.version }}" mkdir -p ./dist/win32 - curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x64.exe" -o "./dist/win32/asyncapi.x64.exe" - curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x86.exe" -o "./dist/win32/asyncapi.x86.exe" + curl --fail --location "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x64.exe" -o "./dist/win32/asyncapi.x64.exe" + if ($LASTEXITCODE -ne 0) { throw 'Windows installer download failed' } - name: Get Checksum of the release if: steps.check_new_version.outputs.new_version == 'true' id: release_checksum run: | - $checksum = (Get-FileHash -Path "./dist/win32/asyncapi.x86.exe" -Algorithm SHA256).Hash $checksum64 = (Get-FileHash -Path "./dist/win32/asyncapi.x64.exe" -Algorithm SHA256).Hash - echo "Setting checksum to $checksum" - echo "checksum=$checksum" >> $env:GITHUB_OUTPUT echo "Setting checksum64 to $checksum64" echo "checksum64=$checksum64" >> $env:GITHUB_OUTPUT @@ -77,7 +74,7 @@ jobs: if: steps.check_new_version.outputs.new_version == 'true' run: | cd ./.github/workflows/deploy/chocolatey - pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} -checksum ${{ steps.release_checksum.outputs.checksum }} -checksum64 ${{ steps.release_checksum.outputs.checksum64 }} + pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} -checksum64 ${{ steps.release_checksum.outputs.checksum64 }} - name: Run Chocolatey Pack if: steps.check_new_version.outputs.new_version == 'true' @@ -95,4 +92,4 @@ jobs: fields: repo,action,workflow text: 'AsyncAPI CLI release to Chocolatey failed' env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 3b9720ea8..580426c72 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -3,6 +3,12 @@ on: release: types: - published + workflow_dispatch: + inputs: + version: + description: 'Existing stable CLI tag to rebuild the action image (vX.Y.Z)' + required: true + type: string permissions: contents: read @@ -67,30 +73,34 @@ jobs: description: CLI to work with your AsyncAPI files publish-action-docker: - if: github.repository == 'asyncapi/cli' && !github.event.release.draft && !github.event.release.prerelease && startsWith(github.event.release.tag_name, 'v') && !contains(github.event.release.tag_name, '-') - name: Release github action for cli and update version in action.yml - runs-on: ubuntu-latest + if: github.repository == 'asyncapi/cli' && (github.event_name == 'workflow_dispatch' || (!github.event.release.draft && !github.event.release.prerelease && startsWith(github.event.release.tag_name, 'v') && !contains(github.event.release.tag_name, '-'))) + name: Build action image (${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + arch: amd64 + - os: ubuntu-24.04-arm + arch: arm64 steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - ref: ${{ github.event.release.tag_name }} + ref: refs/tags/${{ github.event.release.tag_name || inputs.version }} persist-credentials: false - - name: Get version without v character - id: version + - name: Validate release source env: - TAG_NAME: ${{ github.event.release.tag_name }} + TAG_NAME: ${{ github.event.release.tag_name || inputs.version }} run: | [[ "$TAG_NAME" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || exit 1 - VERSION_WITHOUT_V=${TAG_NAME#v} - echo "value=${VERSION_WITHOUT_V}" >> "$GITHUB_OUTPUT" - - - name: Set Up QEMU - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + [[ "v$(node -p "require('./package.json').version")" == "$TAG_NAME" ]] || exit 1 - name: Set Up Docker Buildx - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 - name: Login to Docker Hub uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 @@ -98,21 +108,86 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push - uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 + - name: Build and push by digest + id: build + uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: context: . file: ./github-action/Dockerfile - push: true - tags: | - asyncapi/github-action-for-cli:${{ steps.version.outputs.value }} - asyncapi/github-action-for-cli:latest - platforms: linux/amd64,linux/arm64 + platforms: linux/${{ matrix.arch }} + outputs: type=image,name=asyncapi/github-action-for-cli,push-by-digest=true,name-canonical=true,push=true + + - name: Verify action image + env: + IMAGE: asyncapi/github-action-for-cli@${{ steps.build.outputs.digest }} + run: | + docker run --rm --entrypoint asyncapi "$IMAGE" --version + docker run --rm --entrypoint asyncapi -v "$PWD/github-action/test:/spec:ro" "$IMAGE" validate /spec/asyncapi.yml + + - name: Export image digest + env: + DIGEST: ${{ steps.build.outputs.digest }} + run: | + mkdir -p "$RUNNER_TEMP/digests" + touch "$RUNNER_TEMP/digests/${DIGEST#sha256:}" + + - name: Upload image digest + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: action-image-digest-${{ matrix.arch }} + path: ${{ runner.temp }}/digests/* + if-no-files-found: error + overwrite: true + retention-days: 3 + + publish-action-manifest: + name: Publish multi-platform action image + needs: publish-action-docker + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Download image digests + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + pattern: action-image-digest-* + path: ${{ runner.temp }}/digests + merge-multiple: true - - name: Change directory to github-action + - name: Set Up Docker Buildx + uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - name: Login to Docker Hub + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Publish version tag after both images pass verification + working-directory: ${{ runner.temp }}/digests + env: + TAG_NAME: ${{ github.event.release.tag_name || inputs.version }} + EVENT_NAME: ${{ github.event_name }} run: | - cd github-action/ - ls -la + [[ "$TAG_NAME" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || exit 1 + tags=(--tag "asyncapi/github-action-for-cli:${TAG_NAME#v}") + # Rebuilding an older version must not move latest backwards. + if [[ "$EVENT_NAME" == "release" ]]; then + tags+=(--tag asyncapi/github-action-for-cli:latest) + fi + images=() + for digest in *; do + [[ "$digest" =~ ^[a-f0-9]{64}$ ]] || exit 1 + images+=("asyncapi/github-action-for-cli@sha256:$digest") + done + [[ ${#images[@]} == 2 ]] || exit 1 + docker buildx imagetools create "${tags[@]}" "${images[@]}" + docker buildx imagetools inspect "asyncapi/github-action-for-cli:${TAG_NAME#v}" + + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: refs/tags/${{ github.event.release.tag_name || inputs.version }} + persist-credentials: false - uses: meeDamian/sync-readme@82715041300710d9be7c726c9d6c683b70451087 # v1.0.6 with: diff --git a/.github/workflows/upload-release-assets.yml b/.github/workflows/upload-release-assets.yml index 0bad74149..4ed27f89c 100644 --- a/.github/workflows/upload-release-assets.yml +++ b/.github/workflows/upload-release-assets.yml @@ -16,6 +16,7 @@ jobs: name: Generate and upload assets runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: include: - os: ubuntu-latest @@ -36,18 +37,10 @@ jobs: npm_script: pack:windows dist_folder: win32 extension: x64.exe - - os: ubuntu-latest - npm_script: pack:windows - dist_folder: win32 - extension: x86.exe - os: macos-latest npm_script: pack:macos dist_folder: macos - extension: arm64.pkg - - os: macos-latest - npm_script: pack:macos - dist_folder: macos - extension: x64.pkg + extension: '*.pkg' container: ${{ matrix.container }} @@ -112,13 +105,7 @@ jobs: run: npm run prepublishOnly - name: Assets generation shell: bash - run: | - npm run ${{ matrix.npm_script }} - if [[ "${{ matrix.alpine }}" == "true" ]]; then - npm run pack:rename alpine - else - npm run pack:rename - fi + run: npm run ${{ matrix.npm_script }} - name: Update release uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 diff --git a/docs/installation.md b/docs/installation.md index 0da171527..6e10bd45d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -152,7 +152,7 @@ All the AsyncAPI CLI versions can be found [here](https://chocolatey.org/package Just install the appropriate installer and simply follow the default installation steps to complete the installation process. -Download [asyncapi.x64.exe](https://github.com/asyncapi/cli/releases/latest/download/asyncapi.x64.exe) for 64-bit Windows and download [asyncapi.x86.exe](https://github.com/asyncapi/cli/releases/latest/download/asyncapi.x86.exe) for 32-bit Windows. +Download [asyncapi.x64.exe](https://github.com/asyncapi/cli/releases/latest/download/asyncapi.x64.exe) for 64-bit Windows. Current releases require Node.js 24 and no longer provide a 32-bit Windows installer. ## Linux diff --git a/github-action/Dockerfile b/github-action/Dockerfile index 545e7265e..6522f3a00 100644 --- a/github-action/Dockerfile +++ b/github-action/Dockerfile @@ -5,7 +5,7 @@ FROM node:24-alpine as build COPY ./ /tmp/source_code # Install dependencies -RUN cd /tmp/source_code && npm install --ignore-scripts +RUN cd /tmp/source_code && npm ci --ignore-scripts # Build the source code RUN cd /tmp/source_code && npm run build @@ -40,7 +40,7 @@ RUN apk add --no-cache bash git # Copy the libraries directory from the build stage COPY --from=build /libraries /libraries -RUN cd /libraries && npm install --production --ignore-scripts +RUN cd /libraries && npm ci --omit=dev --ignore-scripts # Create a non-root user # RUN addgroup -S myuser && adduser -S myuser -G myuser diff --git a/package.json b/package.json index abe2f30dd..7e69df1b5 100644 --- a/package.json +++ b/package.json @@ -186,11 +186,11 @@ "generate:languages": "node scripts/generateTypesForGenerateCommand.js", "lint": "eslint --max-warnings 5 .", "lint:fix": "eslint --max-warnings 5 . --fix", - "pack:macos": "oclif pack macos && npm run pack:rename", + "pack:macos": "oclif pack macos --targets darwin-arm64,darwin-x64 && npm run pack:rename", "pack:linux": "oclif pack deb && npm run pack:rename", "pack:tarballs": "oclif pack tarballs -t linux-x64 && npm run pack:rename", "pack:tarballs:alpine": "oclif pack tarballs -t linux-x64 && npm run pack:rename alpine", - "pack:windows": "oclif pack win && npm run pack:rename", + "pack:windows": "oclif pack win --targets win32-x64 && npm run pack:rename", "pack:rename": "node scripts/releasePackagesRename.js", "pretarball": "node ./scripts/pretarball.js", "publish:trusted": "node scripts/publish-trusted.js", diff --git a/scripts/releasePackagesRename.js b/scripts/releasePackagesRename.js index 0a730106e..f293a36ed 100644 --- a/scripts/releasePackagesRename.js +++ b/scripts/releasePackagesRename.js @@ -3,7 +3,7 @@ const { rename, access, mkdir } = require('fs').promises; const packageJson = require('../package.json'); const path = require('path'); -const simpleGit = require('simple-git'); +const { simpleGit } = require('simple-git'); const git = simpleGit({baseDir: process.cwd()}); async function fileExists(checkPath) { From a90bbaaf5a8d6ba6845203e061b065026f5cf0c4 Mon Sep 17 00:00:00 2001 From: Shurtu-gal Date: Sat, 14 Nov 2026 23:07:48 +0530 Subject: [PATCH 2/2] chore: add changeset for release assets fix --- .changeset/fix-release-assets.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/fix-release-assets.md diff --git a/.changeset/fix-release-assets.md b/.changeset/fix-release-assets.md new file mode 100644 index 000000000..19bceb251 --- /dev/null +++ b/.changeset/fix-release-assets.md @@ -0,0 +1,7 @@ +--- +'@asyncapi/cli': patch +--- + +Fix installer generation and publish the GitHub Action image using native x64 and ARM64 builds. + +Windows installers are x64 only, matching the existing Node.js 24 requirement.