-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (82 loc) · 2.85 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
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 }}