Skip to content

Commit

Permalink
feat!: release v4 (#2162)
Browse files Browse the repository at this point in the history
Co-authored-by: Kenneth Aasan <k.aasan@sportradar.com>
Co-authored-by: jano-petras <jano.petras@gmail.com>
Co-authored-by: Nilkanth Parmar <parmarnilkanth@gmail.com>
Co-authored-by: Moritz Kalwa <62842654+moritzkalwa@users.noreply.github.com>
Co-authored-by: Jean-François Côté <jeanfrancois.cote@flo.com>
Co-authored-by: souvik <souvikde.ns@gmail.com>
Co-authored-by: Ashmit JaiSarita Gupta <43639341+devilkiller-ag@users.noreply.github.com>
Co-authored-by: Daniel Kenyon-Jones <github@dlkj.co.uk>
Co-authored-by: Daniel Kenyon-Jones <daniel.kenyon-jones@featurespace.co.uk>
Co-authored-by: Akshit Gupta <96991785+akkshitgupta@users.noreply.github.com>
Co-authored-by: borrull <victor.borrull@gmail.com>
Co-authored-by: Borrull Alonso <victor.borrull@allianz.com>
Co-authored-by: jespitae <jens.spitaels@telenet.be>
Co-authored-by: Axel Hecht <axel@pike.org>
Co-authored-by: Jens Spitaels <Jens.Spitaels@alsic.be>
Co-authored-by: memdal <77838566+memdal@users.noreply.github.com>
Co-authored-by: TertiumOrganum1 <51286827+TertiumOrganum1@users.noreply.github.com>
Co-authored-by: Владислав Муранов <v.muranov@sirena2000.ru>
Co-authored-by: fr-th <61010557+fr-th@users.noreply.github.com>
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Jesse Wayde Brandão <jesse.brandao@fusionpowered.io>
  • Loading branch information
22 people authored Jan 28, 2025
1 parent c579393 commit e9e46b3
Show file tree
Hide file tree
Showing 353 changed files with 33,905 additions and 290,641 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ examples/integrate-with-react
src/processors/TemplateInputProcessor.ts
test/processors/TemplateInputProcessor.spec.ts
modelina-website
modelina-cli

test/runtime/runtime-**
44 changes: 0 additions & 44 deletions .github/workflows/blackbox-testing.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/bump-homebrew-formula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Bump Homebrew formula for Modelina

on:
# Since now release depends on schedule, might be that there is a situation we cannot wait for schedule and trigger release manually
workflow_dispatch:
# We cannot run brew release continusly every time we release something as sometimes we release a couple of times a day and overload brew pipelines
# More details https://github.com/asyncapi/cli/issues/503
# schedule:
# - cron: "0 23 * * *"

jobs:
bump-formula-in-homebrew:
if: github.repository == 'asyncapi/modelina'
name: Bump the formula in homebrew-core repo
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Get version from package.json
id: extractver
run: echo "version=$(npm run get-version --silent)" >> $GITHUB_OUTPUT
- uses: mislav/bump-homebrew-formula-action@v2
with:
# A PR will be sent to github.com/Homebrew/homebrew-core to update AsyncAPI Modelina formula:
formula-name: modelina
# https://github.com/mislav/bump-homebrew-formula-action/issues/58
formula-path: Formula/a/modelina.rb
tag-name: ${{ steps.extractver.outputs.version }}
download-url: https://registry.npmjs.org/@asyncapi/modelina/-/modelina-${{ steps.extractver.outputs.version }}.tgz #we need to point to npm not github as there is a dist that is not on github
env:
COMMITTER_TOKEN: ${{ secrets.GH_TOKEN_BOT_EVE }}
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
name: Report workflow run status to Slack
uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'AsyncAPI Modelina release to BREW failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
31 changes: 31 additions & 0 deletions .github/workflows/deploy/chocolatey/asyncapi-modelina.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>modelina</id>
<version>{{version}}</version>
<packageSourceUrl>https://github.com/asyncapi/modelina/releases/v{{version}}</packageSourceUrl>
<owners>AsyncAPI_Initiative</owners>

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>modelina</title>
<authors>AsyncAPI_Initiative</authors>
<projectUrl>https://www.asyncapi.com/</projectUrl>
<iconUrl>https://avatars.githubusercontent.com/u/16401334?s=200</iconUrl>
<copyright>2024 AsyncAPI Initiative</copyright>
<licenseUrl>https://github.com/asyncapi/modelina/blob/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>https://github.com/asyncapi/modelina/releases/v{{version}}</releaseNotes>
<projectSourceUrl>https://github.com/asyncapi/modelina</projectSourceUrl>
<docsUrl>https://www.asyncapi.com/docs/tools/modelina</docsUrl>
<bugTrackerUrl>https://github.com/asyncapi/modelina/issues/new/choose</bugTrackerUrl>
<tags>asyncapi-modelina modelina nodejs api asyncapi</tags>
<summary>Modelina CLI to generate any kind of model from any kind of input!</summary>
<description>Modelina CLI to generate any kind of model in TypeScript, Java, Kotlin, C#, C++, and so much more from AsyncAPI, JSON Schema, OpenAPI, TypeScript files, etc!</description>
</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
</files>
</package>
19 changes: 19 additions & 0 deletions .github/workflows/deploy/chocolatey/replace.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
param (
[Parameter(Mandatory=$true)]
[string]$version,
[string]$checksum,
[string]$checksum64
)

$filePaths = @(
'./tools/chocolateyinstall.ps1'
'./modelina.nuspec'
)

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
}
26 changes: 26 additions & 0 deletions .github/workflows/deploy/chocolatey/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
$ErrorActionPreference = 'Stop' # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$url = 'https://github.com/asyncapi/modelina/releases/download/v{{version}}/modelina.x86.exe'
$url64 = 'https://github.com/asyncapi/modelina/releases/download/v{{version}}/modelina.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 = 'modelina*'

checksum = '{{checksum}}'
checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512
checksum64 = '{{checksum64}}'
checksumType64= 'sha256' #default is checksumType

validExitCodes= @(0, 3010, 1641)
silentArgs = '/S' # NSIS
}

Install-ChocolateyPackage @packageArgs # https://docs.chocolatey.org/en-us/create/functions/install-chocolateypackage
1 change: 1 addition & 0 deletions .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
)
)
id: should_run
shell: bash
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/release-chocolatey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release Chocolatey Package
on:
# We cannot run chocolatey release continuously every time we release something as sometimes we release a couple of times a day and overload chocolatey pipelines
# More details https://github.com/asyncapi/cli/issues/503
# schedule:
# - cron: '0 23 * * *' # Run every day at 23:00 UTC
# Since now release depends on schedule, might be that there is a situation we cannot wait for schedule and trigger release manually
workflow_dispatch:
inputs:
version:
description: 'Version to release (optional)'
required: false

jobs:
release:
name: Publish to Chocolatey Community
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set Version
id: release_version
run: |
if ( "${{ github.event_name }}" -eq "workflow_dispatch" -and "${{ github.event.inputs.version }}" -ne "" ) {
$version = "${{ github.event.inputs.version }}"
}
else {
$version = $(npm pkg get version)
}
$version = $version.Replace("`"", "")
echo "Setting version to $version"
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Check if this is a new version to release
id: check_new_version
run: |
$output = choco search asyncapi-cli --version=${{ steps.release_version.outputs.version }}
# Output is of the form:
# Chocolatey v2.2.2
# asyncapi-cli 0.0.1 [Approved]
# 1 packages found.
# If the version is not found, the output will of the form:
# Chocolatey v2.2.2
# 0 packages found.
if ($output -match "0 packages found.") {
echo "This is a new version to release"
echo "new_version=true" >> $env:GITHUB_OUTPUT
}
else {
echo "This is not a new version to release"
echo "new_version=false" >> $env:GITHUB_OUTPUT
}
- name: Download release
if: steps.check_new_version.outputs.new_version == 'true'
run: |
echo "Downloading release assets for version ${{ steps.release_version.outputs.version }}"
mkdir -p ./dist
curl -L "https://github.com/asyncapi/modelina/releases/download/v${{ steps.release_version.outputs.version }}/modelina.x64.exe" -o "./modelina-cli/dist/win32/modelina.x64.exe"
curl -L "https://github.com/asyncapi/modelina/releases/download/v${{ steps.release_version.outputs.version }}/modelina.x86.exe" -o "./modelina-cli/dist/win32/modelina.x86.exe"
- name: Get Checksum of the release
id: release_checksum
run: |
$checksum = (Get-FileHash -Path "./modelina-cli/dist/win32/modelina.x86.exe" -Algorithm SHA256).Hash
$checksum64 = (Get-FileHash -Path "./modelina-cli/dist/win32/modelina.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
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 }}
- name: Run Chocolatey Pack
run: |
cd ./.github/workflows/deploy/chocolatey
choco pack ./modelina.nuspec
choco apikey add --source "'https://push.chocolatey.org/'" --key ${{ secrets.CHOCOLATEY_API_KEY }}
choco push ./modelina.${{ steps.release_version.outputs.version }}.nupkg --source "'https://push.chocolatey.org/'"
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
name: Report workflow run status to Slack
uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'AsyncAPI Modelina release to Chocolatey failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
89 changes: 89 additions & 0 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Upload custom assets to GitHub release

on:
# It cannot run on release event as when release is created then version is not yet bumped in package.json
# This means we cannot extract easily latest version and have a risk that package is not yet on npm
push:
branches:
- master
- next

jobs:
upload-assets:
name: Generate and upload assets
if: startsWith(github.event.commits[0].message, 'chore(release):')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
npm_script: pack:linux
dist_folder: deb
extension: deb
- os: ubuntu-latest
npm_script: pack:tarballs
dist_folder: tar
extension: tar.gz
- os: windows-latest
npm_script: pack:windows
dist_folder: win32
extension: x64.exe
- os: windows-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
steps:
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v3
- name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.lockversion.outputs.version }}"
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Get version from package.json
uses: actions/github-script@v6
id: extractver
with:
script: |
const packageJson = require('./package.json');
const packageJsonVersion = packageJson.version;
core.setOutput('version', packageJsonVersion);
- name: Install dependencies
run: npm install
- name: Build project
run: npm run prepublishOnly
- name: Assets generation
shell: bash
run: cd modelina-cli && npm run ${{ matrix.npm_script }}
- name: Update release
uses: softprops/action-gh-release@v1
with:
files: modelina-cli/dist/${{ matrix.dist_folder }}/modelina.${{ matrix.extension }}
tag_name: v${{ steps.extractver.outputs.version }}
token: ${{ secrets.GH_TOKEN }}
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
name: Report workflow run status to Slack
uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'AsyncAPI Modelina release build artifacts failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lib
node_modules
modelina-website
modelina-cli
test/runtime/runtime-**
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80
"printWidth": 80,
"endOfLine": "auto"
}
Loading

0 comments on commit e9e46b3

Please sign in to comment.