Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fix-release-assets.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 1 addition & 3 deletions .github/workflows/deploy/chocolatey/replace.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
param (
[Parameter(Mandatory=$true)]
[string]$version,
[string]$checksum,
[string]$checksum64
)

Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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

Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/release-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -59,25 +59,22 @@ 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

- name: Make nuspec from the template
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'
Expand All @@ -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 }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
121 changes: 98 additions & 23 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,52 +73,121 @@ 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
with:
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:
Expand Down
19 changes: 3 additions & 16 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
name: Generate and upload assets
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
Expand All @@ -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 }}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions github-action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/releasePackagesRename.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading