-
Notifications
You must be signed in to change notification settings - Fork 8
156 lines (134 loc) · 4.93 KB
/
publish.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Build and publish desktop app
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
id-token: write
concurrency:
group: releases
cancel-in-progress: true
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip release]')"
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Get version from package.json
id: packageJson
uses: RadovanPelka/github-action-json@main
with:
path: 'package.json'
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Cache release assets
uses: actions/cache@v3
with:
path: ./release
key: ${{ runner.os }}-release-${{github.sha}}
restore-keys: |
${{ runner.os }}-release-
- name: Build
run: yarn make
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_GOOGLE_CLIENT_ID: ${{ secrets.GCLIENT }}
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: release-${{ runner.os }}
path: ./release
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Get version from package.json
id: packageJson
uses: RadovanPelka/github-action-json@main
with:
path: 'package.json'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}-${{ github.run_id }}
release_name: v${{steps.packageJson.outputs.version}}
draft: false
prerelease: false
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Upload Release Asset - Ubuntu
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-Linux/koala-client-${{steps.packageJson.outputs.version}}-linux-x86_64.AppImage
asset_name: KoalaClient-${{steps.packageJson.outputs.version}}-linux-x86_64.AppImage
asset_content_type: application
- name: Upload Release Asset - MacOS
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-macOS/koala-client-${{steps.packageJson.outputs.version}}-mac-x64.dmg
asset_name: KoalaClient-${{steps.packageJson.outputs.version}}-mac-x64.dmg
asset_content_type: application
- name: Upload Release Asset - Windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-Windows/koala-client-${{steps.packageJson.outputs.version}}-win-x64.exe
asset_name: KoalaClient-${{steps.packageJson.outputs.version}}-win-x64.exe
asset_content_type: application
- name: Zip Unpacked Release - Windows
run: |
cd ./release-Windows
7z a win-unpacked.zip win-unpacked/
cd ..
- name: Upload Unpacked Release - Windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-Windows/win-unpacked.zip
asset_name: KoalaClient-${{steps.packageJson.outputs.version}}-win-x64-portable.zip
asset_content_type: zip
- name: Zip Hash Info
run: |
7z a hash-info.zip ./release-Linux/latest-linux.yml ./release-macOS/latest-mac.yml
cp ./release-Windows/latest.yml ./release-Windows/latest-windows.yml
7z a hash-info.zip ./release-Windows/latest-windows.yml
- name: Upload Hash Info
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hash-info.zip
asset_name: hash-info.zip
asset_content_type: zip