-
-
Notifications
You must be signed in to change notification settings - Fork 157
87 lines (85 loc) · 3.15 KB
/
upload-release-assets.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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 }}
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: 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: 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: 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 }}/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 }}