Skip to content

Commit db478a8

Browse files
committed
Add build release workflow
1 parent 4d4e744 commit db478a8

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build release binaries
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
10+
strategy:
11+
matrix:
12+
node-version: [8.9.4]
13+
platform: [ubuntu-16.04, macos-latest, windows-latest]
14+
15+
runs-on: ${{ matrix.platform }}
16+
17+
steps:
18+
- run: echo "${{ github.event.release.tag_name }}"
19+
- uses: actions/checkout@v2
20+
with:
21+
ref: ${{ github.event.release.tag_name }}
22+
23+
- name: get-npm-version
24+
id: package-version
25+
uses: martinbeentjes/npm-get-version-action@master
26+
27+
- name: Validate version
28+
run: echo "Wrong tag"
29+
if: ${{ github.event.release.tag_name != format('{0}{1}', 'v', steps.package-version.outputs.current-version) }}
30+
31+
- name: Get current date
32+
uses: 1466587594/get-current-time@v2
33+
id: date
34+
with:
35+
format: YYYY_MM_DD
36+
utcOffset: "+08:00"
37+
- name: Download ljm
38+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
39+
uses: wei/wget@v1
40+
with:
41+
args: -O labjack_ljm_software.tar.gz https://labjack.com/sites/default/files/software/labjack_ljm_software_2019_07_16_x86_64.tar.gz
42+
- name: Install ljm
43+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
44+
run: tar xfz labjack_ljm_software.tar.gz && cd ./labjack_ljm_software_2019_07_16_x86_64 && sudo ./labjack_ljm_installer.run
45+
- uses: actions/checkout@v2
46+
- name: Use Node.js ${{ matrix.node-version }}
47+
uses: actions/setup-node@v1
48+
with:
49+
node-version: ${{ matrix.node-version }}
50+
# - run: npm ci # doesn't work with node8
51+
- run: npm install --global node-gyp@latest
52+
- run: npm install --global --production windows-build-tools --vs2015
53+
if: ${{ matrix.platform == 'windows-latest' }}
54+
- run: npm install
55+
- run: npm config set msvs_version 2015
56+
- run: npm run setup
57+
- name: Fix lerna mess
58+
run: node ./scripts/fix_lerna_backup.js
59+
- run: OVERRIDE_BUILD_DATE=${{ steps.date.outputs.formattedTime }} npm run build
60+
- run: SKIP_HARDWARE_TEST=true npm run test
61+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
62+
63+
- name: Upload Release Asset
64+
uses: actions/upload-release-asset@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
upload_url: ${{ github.event.release.upload_url }}
69+
asset_path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_linux64.tar.gz
70+
asset_name: kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_linux64.tar.gz
71+
asset_content_type: application/zip
72+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
73+
74+
- name: Upload Release Asset
75+
uses: actions/upload-release-asset@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
upload_url: ${{ github.event.release.upload_url }}
80+
asset_path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_win64.tar.gz
81+
asset_name: kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_win64.tar.gz
82+
asset_content_type: application/zip
83+
if: ${{ matrix.platform == 'windows-latest' }}
84+
85+
- name: Upload Release Asset
86+
uses: actions/upload-release-asset@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
upload_url: ${{ github.event.release.upload_url }}
91+
asset_path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_mac64.tar.gz
92+
asset_name: kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_mac64.tar.gz
93+
asset_content_type: application/zip
94+
if: ${{ matrix.platform == 'macos-latest' }}

ljswitchboard-builder/build_scripts/compress_output.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ if(dayStr.length < 2) {
5252
}
5353
var dateStrPartial = [yearStr,monthStr,dayStr].join('_') + '_';
5454

55+
if (process.env.OVERRIDE_BUILD_DATE) {
56+
dateStrPartial =process.env.OVERRIDE_BUILD_DATE + '_';
57+
}
58+
5559
var osForOutputFileName = {
5660
'darwin': 'mac',
5761
'win32': 'win',

0 commit comments

Comments
 (0)