Skip to content

chore(release): release and bump versions of packages (#1593) #10

chore(release): release and bump versions of packages (#1593)

chore(release): release and bump versions of packages (#1593) #10

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
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 }}"
- if: matrix.npm_script == 'pack:windows'
name: install nodejs for windows
uses: actions/setup-node@v4
with:
node-version: 20
- 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: matrix.npm_script == 'pack:windows'
#npm cli 10 is buggy because of some cache issue
name: Install npm cli 10
shell: bash
run: npm install -g npm@latest
- 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 }}/asyncapi.${{ 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 CLI release build artifacts failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}