-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (71 loc) · 2.91 KB
/
publish-release.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
name: Release fosslight_scanner_gui
on:
release:
types: [published]
jobs:
build:
name: Build packages
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
TARGET: ubuntu
ASSET_MIME: application/gzip
- os: macos-latest
TARGET: macos
ASSET_MIME: application/zip
- os: windows-latest
TARGET: windows
ASSET_MIME: application/vnd.microsoft.portable-executable
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
shell: bash
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: yarn install
- name: Clean previous build
run: npm run clean
- name: Build with yarn for ${{ matrix.TARGET }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
if [ "${{ matrix.TARGET }}" == "ubuntu" ]; then
yarn build
sleep 5
tar -czf fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.tar.gz -C dist/linux-unpacked .
mv fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.tar.gz fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.tar.gz
elif [ "${{ matrix.TARGET }}" == "macos" ]; then
yarn build:mac
sleep 5
ditto -c -k --sequesterRsrc --keepParent "dist/mac/fosslight_gui.app" fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip
mv fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.zip
echo "current location..."
pwd
elif [ "${{ matrix.TARGET }}" == "windows" ]; then
yarn build:win
sleep 5
7z a -tzip ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip ./dist/win-unpacked/*
mv ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.zip
echo "Listing dist directory..."
ls ./dist
echo "current location..."
pwd
fi
shell: bash
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.${{ matrix.TARGET == 'ubuntu' && 'tar.gz' || matrix.TARGET == 'macos' && 'zip' || 'zip' }}
asset_name: fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.${{ matrix.TARGET == 'ubuntu' && 'tar.gz' || matrix.TARGET == 'macos' && 'zip' || 'zip' }}
asset_content_type: ${{ matrix.ASSET_MIME }}