-
Notifications
You must be signed in to change notification settings - Fork 20
131 lines (105 loc) · 3.92 KB
/
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
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
name: Release
on:
push:
tags: [ "v*-electron" ]
jobs:
build-linux:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Install build depndencies
run: |
sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib
- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: ./openfortivpn-webview-electron/package-lock.json
- name: Install npm dependencies
working-directory: ./openfortivpn-webview-electron
run: npm install
- name: Build the app
working-directory: ./openfortivpn-webview-electron
run: npm run dist:linux
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./openfortivpn-webview-electron/dist/openfortivpn-webview-*.*
build-mac:
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: ./openfortivpn-webview-electron/package-lock.json
- name: Install dependencies
working-directory: ./openfortivpn-webview-electron
run: npm install
- name: Build the app
working-directory: ./openfortivpn-webview-electron
run: npm run dist:mac
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./openfortivpn-webview-electron/dist/openfortivpn-webview-*.*
- name: Setup SSH
run: |
print_git_config() {
cat <<EOF
Host homebrew-repo
Hostname github.com
IdentityFile=~/.ssh/hombrew_repo
EOF
}
print_git_config >> ~/.ssh/config
echo "$GH_HOMEBREW_REPO_DEPLOY_KEY" > ~/.ssh/hombrew_repo
chmod 0644 ~/.ssh/config
chmod 0600 ~/.ssh/hombrew_repo
env:
GH_HOMEBREW_REPO_DEPLOY_KEY: ${{ secrets.GH_HOMEBREW_REPO_DEPLOY_KEY }}
- name: Update homebrew-repo
run: |
app_version=$(echo ${{ github.ref_name }} | sed -E 's/v([0-9.]+)-electron/\1/g')
sha256_arm=$(shasum -a 256 openfortivpn-webview-electron/dist/openfortivpn-webview-*-arm64.dmg | awk '{print $1}')
sha256_intel=$(shasum -a 256 openfortivpn-webview-electron/dist/openfortivpn-webview-*-x64.dmg | awk '{print $1}')
print_updated_cask() {
cat <<EOF
cask "openfortivpn-webview" do
arch arm: "arm64", intel: "x64"
version "$app_version"
sha256 arm: "$sha256_arm",
intel: "$sha256_intel"
url "https://github.com/${{ github.repository_owner }}/openfortivpn-webview/releases/download/v#{version}-electron/openfortivpn-webview-#{version}-#{arch}.dmg"
name "openfortivpn-webview"
homepage "https://github.com/${{ github.repository_owner }}/openfortivpn-webview"
wrapper_script = "#{staged_path}/openfortivpn-webview.sh"
binary wrapper_script, target: "openfortivpn-webview"
preflight do
File.write wrapper_script, <<~EOS
#!/bin/sh
"#{staged_path}/openfortivpn-webview.app/Contents/MacOS/openfortivpn-webview" "\$@"
EOS
end
zap trash: "~/Library/Application Support/openfortivpn-webview/"
end
EOF
}
git clone git@homebrew-repo:${{ github.repository_owner }}/homebrew-repo.git
cd homebrew-repo
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
print_updated_cask > Casks/openfortivpn-webview.rb
git commit Casks/openfortivpn-webview.rb -m "openfortivpn-webview $app_version"
git push origin main