Skip to content

fix: weird payload generation (#166) #126

fix: weird payload generation (#166)

fix: weird payload generation (#166) #126

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:
- main
- next
jobs:
upload-assets:
name: Generate and upload assets
if: startsWith(github.event.commits[0].message, 'chore(release):')
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
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: ubuntu-latest
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
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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@v4
with:
node-version: "${{ steps.lockversion.outputs.version }}"
- 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);
- if: matrix.npm_script == 'pack:windows'
#fix for windows build issue #1433
name: Install p7zip-full nsis
run: sudo apt-get install -y p7zip-full nsis
- if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest'
#npm cli 10 is buggy because of some cache issue
name: Install npm cli 8
shell: bash
run: npm install -g [email protected]
- name: Install dependencies
run: npm ci
- name: Build project
shell: bash
run: npm run prepublishOnly
- name: Assets generation
shell: bash
run: npm run ${{ matrix.npm_script }}
- name: Update release
uses: softprops/action-gh-release@v1
with:
files: dist/${{ matrix.dist_folder }}/codegen.${{ matrix.extension }}
tag_name: v${{ steps.extractver.outputs.version }}
token: ${{ secrets.GH_TOKEN }}