Skip to content

Commit e9e46b3

Browse files
jonaslagonikennethaasanjano-petrasnilkanth987marakalwa
authored
feat!: release v4 (#2162)
Co-authored-by: Kenneth Aasan <[email protected]> Co-authored-by: jano-petras <[email protected]> Co-authored-by: Nilkanth Parmar <[email protected]> Co-authored-by: Moritz Kalwa <[email protected]> Co-authored-by: Jean-François Côté <[email protected]> Co-authored-by: souvik <[email protected]> Co-authored-by: Ashmit JaiSarita Gupta <[email protected]> Co-authored-by: Daniel Kenyon-Jones <[email protected]> Co-authored-by: Daniel Kenyon-Jones <[email protected]> Co-authored-by: Akshit Gupta <[email protected]> Co-authored-by: borrull <[email protected]> Co-authored-by: Borrull Alonso <[email protected]> Co-authored-by: jespitae <[email protected]> Co-authored-by: Axel Hecht <[email protected]> Co-authored-by: Jens Spitaels <[email protected]> Co-authored-by: memdal <[email protected]> Co-authored-by: TertiumOrganum1 <[email protected]> Co-authored-by: Владислав Муранов <[email protected]> Co-authored-by: fr-th <[email protected]> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Jesse Wayde Brandão <[email protected]>
1 parent c579393 commit e9e46b3

File tree

353 files changed

+33905
-290641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+33905
-290641
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ examples/integrate-with-react
99
src/processors/TemplateInputProcessor.ts
1010
test/processors/TemplateInputProcessor.spec.ts
1111
modelina-website
12+
modelina-cli
1213

1314
test/runtime/runtime-**

.github/workflows/blackbox-testing.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Bump Homebrew formula for Modelina
2+
3+
on:
4+
# Since now release depends on schedule, might be that there is a situation we cannot wait for schedule and trigger release manually
5+
workflow_dispatch:
6+
# 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
7+
# More details https://github.com/asyncapi/cli/issues/503
8+
# schedule:
9+
# - cron: "0 23 * * *"
10+
11+
jobs:
12+
bump-formula-in-homebrew:
13+
if: github.repository == 'asyncapi/modelina'
14+
name: Bump the formula in homebrew-core repo
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repo
18+
uses: actions/checkout@v3
19+
- name: Get version from package.json
20+
id: extractver
21+
run: echo "version=$(npm run get-version --silent)" >> $GITHUB_OUTPUT
22+
- uses: mislav/bump-homebrew-formula-action@v2
23+
with:
24+
# A PR will be sent to github.com/Homebrew/homebrew-core to update AsyncAPI Modelina formula:
25+
formula-name: modelina
26+
# https://github.com/mislav/bump-homebrew-formula-action/issues/58
27+
formula-path: Formula/a/modelina.rb
28+
tag-name: ${{ steps.extractver.outputs.version }}
29+
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
30+
env:
31+
COMMITTER_TOKEN: ${{ secrets.GH_TOKEN_BOT_EVE }}
32+
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
33+
name: Report workflow run status to Slack
34+
uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1
35+
with:
36+
status: ${{ job.status }}
37+
fields: repo,action,workflow
38+
text: 'AsyncAPI Modelina release to BREW failed'
39+
env:
40+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- 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. -->
3+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
4+
<metadata>
5+
<id>modelina</id>
6+
<version>{{version}}</version>
7+
<packageSourceUrl>https://github.com/asyncapi/modelina/releases/v{{version}}</packageSourceUrl>
8+
<owners>AsyncAPI_Initiative</owners>
9+
10+
<!-- == SOFTWARE SPECIFIC SECTION == -->
11+
<!-- This section is about the software itself -->
12+
<title>modelina</title>
13+
<authors>AsyncAPI_Initiative</authors>
14+
<projectUrl>https://www.asyncapi.com/</projectUrl>
15+
<iconUrl>https://avatars.githubusercontent.com/u/16401334?s=200</iconUrl>
16+
<copyright>2024 AsyncAPI Initiative</copyright>
17+
<licenseUrl>https://github.com/asyncapi/modelina/blob/master/LICENSE</licenseUrl>
18+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
19+
<releaseNotes>https://github.com/asyncapi/modelina/releases/v{{version}}</releaseNotes>
20+
<projectSourceUrl>https://github.com/asyncapi/modelina</projectSourceUrl>
21+
<docsUrl>https://www.asyncapi.com/docs/tools/modelina</docsUrl>
22+
<bugTrackerUrl>https://github.com/asyncapi/modelina/issues/new/choose</bugTrackerUrl>
23+
<tags>asyncapi-modelina modelina nodejs api asyncapi</tags>
24+
<summary>Modelina CLI to generate any kind of model from any kind of input!</summary>
25+
<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>
26+
</metadata>
27+
<files>
28+
<!-- this section controls what actually gets packaged into the Chocolatey package -->
29+
<file src="tools\**" target="tools" />
30+
</files>
31+
</package>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
param (
2+
[Parameter(Mandatory=$true)]
3+
[string]$version,
4+
[string]$checksum,
5+
[string]$checksum64
6+
)
7+
8+
$filePaths = @(
9+
'./tools/chocolateyinstall.ps1'
10+
'./modelina.nuspec'
11+
)
12+
13+
foreach ($filePath in $filePaths) {
14+
$fileContents = Get-Content $filePath
15+
$fileContents = $fileContents -replace '{{version}}', $version
16+
$fileContents = $fileContents -replace '{{checksum}}', $checksum
17+
$fileContents = $fileContents -replace '{{checksum64}}', $checksum64
18+
Set-Content $filePath $fileContents
19+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
$ErrorActionPreference = 'Stop' # stop on all errors
2+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
3+
4+
$url = 'https://github.com/asyncapi/modelina/releases/download/v{{version}}/modelina.x86.exe'
5+
$url64 = 'https://github.com/asyncapi/modelina/releases/download/v{{version}}/modelina.x64.exe'
6+
7+
$packageArgs = @{
8+
packageName = $env:ChocolateyPackageName
9+
unzipLocation = $toolsDir
10+
fileType = 'EXE'
11+
url = $url
12+
url64bit = $url64
13+
#file = $fileLocation NOTE: Commented out because we are using url instead
14+
15+
softwareName = 'modelina*'
16+
17+
checksum = '{{checksum}}'
18+
checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512
19+
checksum64 = '{{checksum64}}'
20+
checksumType64= 'sha256' #default is checksumType
21+
22+
validExitCodes= @(0, 3010, 1641)
23+
silentArgs = '/S' # NSIS
24+
}
25+
26+
Install-ChocolateyPackage @packageArgs # https://docs.chocolatey.org/en-us/create/functions/install-chocolateypackage

.github/workflows/if-nodejs-pr-testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
)
3232
)
3333
id: should_run
34+
shell: bash
3435
name: Should Run
3536
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
3637
- if: steps.should_run.outputs.shouldrun == 'true'
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Release Chocolatey Package
2+
on:
3+
# 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
4+
# More details https://github.com/asyncapi/cli/issues/503
5+
# schedule:
6+
# - cron: '0 23 * * *' # Run every day at 23:00 UTC
7+
# Since now release depends on schedule, might be that there is a situation we cannot wait for schedule and trigger release manually
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Version to release (optional)'
12+
required: false
13+
14+
jobs:
15+
release:
16+
name: Publish to Chocolatey Community
17+
runs-on: windows-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Set Version
23+
id: release_version
24+
run: |
25+
if ( "${{ github.event_name }}" -eq "workflow_dispatch" -and "${{ github.event.inputs.version }}" -ne "" ) {
26+
$version = "${{ github.event.inputs.version }}"
27+
}
28+
else {
29+
$version = $(npm pkg get version)
30+
}
31+
32+
$version = $version.Replace("`"", "")
33+
echo "Setting version to $version"
34+
echo "version=$version" >> $env:GITHUB_OUTPUT
35+
36+
- name: Check if this is a new version to release
37+
id: check_new_version
38+
run: |
39+
$output = choco search asyncapi-cli --version=${{ steps.release_version.outputs.version }}
40+
# Output is of the form:
41+
# Chocolatey v2.2.2
42+
# asyncapi-cli 0.0.1 [Approved]
43+
# 1 packages found.
44+
# If the version is not found, the output will of the form:
45+
# Chocolatey v2.2.2
46+
# 0 packages found.
47+
if ($output -match "0 packages found.") {
48+
echo "This is a new version to release"
49+
echo "new_version=true" >> $env:GITHUB_OUTPUT
50+
}
51+
else {
52+
echo "This is not a new version to release"
53+
echo "new_version=false" >> $env:GITHUB_OUTPUT
54+
}
55+
- name: Download release
56+
if: steps.check_new_version.outputs.new_version == 'true'
57+
run: |
58+
echo "Downloading release assets for version ${{ steps.release_version.outputs.version }}"
59+
mkdir -p ./dist
60+
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"
61+
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"
62+
63+
- name: Get Checksum of the release
64+
id: release_checksum
65+
run: |
66+
$checksum = (Get-FileHash -Path "./modelina-cli/dist/win32/modelina.x86.exe" -Algorithm SHA256).Hash
67+
$checksum64 = (Get-FileHash -Path "./modelina-cli/dist/win32/modelina.x64.exe" -Algorithm SHA256).Hash
68+
echo "Setting checksum to $checksum"
69+
echo "checksum=$checksum" >> $env:GITHUB_OUTPUT
70+
echo "Setting checksum64 to $checksum64"
71+
echo "checksum64=$checksum64" >> $env:GITHUB_OUTPUT
72+
73+
- name: Make nuspec from the template
74+
run: |
75+
cd ./.github/workflows/deploy/chocolatey
76+
pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} -checksum ${{ steps.release_checksum.outputs.checksum }} -checksum64 ${{ steps.release_checksum.outputs.checksum64 }}
77+
78+
- name: Run Chocolatey Pack
79+
run: |
80+
cd ./.github/workflows/deploy/chocolatey
81+
choco pack ./modelina.nuspec
82+
choco apikey add --source "'https://push.chocolatey.org/'" --key ${{ secrets.CHOCOLATEY_API_KEY }}
83+
choco push ./modelina.${{ steps.release_version.outputs.version }}.nupkg --source "'https://push.chocolatey.org/'"
84+
85+
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
86+
name: Report workflow run status to Slack
87+
uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1
88+
with:
89+
status: ${{ job.status }}
90+
fields: repo,action,workflow
91+
text: 'AsyncAPI Modelina release to Chocolatey failed'
92+
env:
93+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Upload custom assets to GitHub release
2+
3+
on:
4+
# It cannot run on release event as when release is created then version is not yet bumped in package.json
5+
# This means we cannot extract easily latest version and have a risk that package is not yet on npm
6+
push:
7+
branches:
8+
- master
9+
- next
10+
11+
jobs:
12+
upload-assets:
13+
name: Generate and upload assets
14+
if: startsWith(github.event.commits[0].message, 'chore(release):')
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: ubuntu-latest
21+
npm_script: pack:linux
22+
dist_folder: deb
23+
extension: deb
24+
- os: ubuntu-latest
25+
npm_script: pack:tarballs
26+
dist_folder: tar
27+
extension: tar.gz
28+
- os: windows-latest
29+
npm_script: pack:windows
30+
dist_folder: win32
31+
extension: x64.exe
32+
- os: windows-latest
33+
npm_script: pack:windows
34+
dist_folder: win32
35+
extension: x86.exe
36+
- os: macos-latest
37+
npm_script: pack:macos
38+
dist_folder: macos
39+
extension: arm64.pkg
40+
- os: macos-latest
41+
npm_script: pack:macos
42+
dist_folder: macos
43+
extension: x64.pkg
44+
steps:
45+
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
46+
run: |
47+
git config --global core.autocrlf false
48+
git config --global core.eol lf
49+
- name: Checkout repository
50+
uses: actions/checkout@v3
51+
- name: Check package-lock version
52+
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
53+
id: lockversion
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v3
56+
with:
57+
node-version: "${{ steps.lockversion.outputs.version }}"
58+
cache: 'npm'
59+
cache-dependency-path: '**/package-lock.json'
60+
- name: Get version from package.json
61+
uses: actions/github-script@v6
62+
id: extractver
63+
with:
64+
script: |
65+
const packageJson = require('./package.json');
66+
const packageJsonVersion = packageJson.version;
67+
core.setOutput('version', packageJsonVersion);
68+
- name: Install dependencies
69+
run: npm install
70+
- name: Build project
71+
run: npm run prepublishOnly
72+
- name: Assets generation
73+
shell: bash
74+
run: cd modelina-cli && npm run ${{ matrix.npm_script }}
75+
- name: Update release
76+
uses: softprops/action-gh-release@v1
77+
with:
78+
files: modelina-cli/dist/${{ matrix.dist_folder }}/modelina.${{ matrix.extension }}
79+
tag_name: v${{ steps.extractver.outputs.version }}
80+
token: ${{ secrets.GH_TOKEN }}
81+
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
82+
name: Report workflow run status to Slack
83+
uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1
84+
with:
85+
status: ${{ job.status }}
86+
fields: repo,action,workflow
87+
text: 'AsyncAPI Modelina release build artifacts failed'
88+
env:
89+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lib
22
node_modules
33
modelina-website
4+
modelina-cli
45
test/runtime/runtime-**

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"semi": true,
33
"trailingComma": "none",
44
"singleQuote": true,
5-
"printWidth": 80
5+
"printWidth": 80,
6+
"endOfLine": "auto"
67
}

0 commit comments

Comments
 (0)