-
Notifications
You must be signed in to change notification settings - Fork 3
179 lines (152 loc) · 5.72 KB
/
Copy pathrelease.yml
File metadata and controls
179 lines (152 loc) · 5.72 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Build and Release Electron App
on:
push:
tags:
- 'v*.*.*' # Trigger on version tags like v1.0.0
permissions:
contents: write
jobs:
buildExe:
strategy:
matrix:
include:
- os: ubuntu-latest
name: linux
- os: windows-latest
name: nsis
- os: windows-latest
name: appx
- os: macos-14
name: mac
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up Python (macOS için distutils)
if: matrix.os == 'macos-14'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python build deps (macOS)
if: matrix.os == 'macos-14'
run: |
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade pip setuptools
- name: Install dependencies
run: npm install
- name: Build Electron App
shell: bash
run: |
if [ "${{ matrix.name }}" = "linux" ]; then
npm run build:linux
elif [ "${{ matrix.name }}" = "nsis" ]; then
npm run build:winexe
elif [ "${{ matrix.name }}" = "appx" ]; then
npm run build:winstore
elif [ "${{ matrix.name }}" = "mac" ]; then
npm run build:mac
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ✅ Package.json'dan version bilgisini al
- name: Get version from package.json
if: matrix.os == 'windows-latest'
id: package-version
run: |
$version = (Get-Content package.json | ConvertFrom-Json).version
echo "version=$version" >> $env:GITHUB_OUTPUT
echo "Version: $version"
shell: powershell
# ✅ Dosyaların varlığını kontrol et
- name: List dist files (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "Checking dist directory contents:"
if (Test-Path "dist") {
Get-ChildItem -Path "dist" -Recurse | ForEach-Object { Write-Host $_.FullName }
} else {
Write-Host "dist directory does not exist!"
exit 1
}
shell: powershell
# ✅ Windows için eSigner ile imzala - NSIS Installer
- name: Sign NSIS Installer
if: matrix.os == 'windows-latest' && matrix.name == 'nsis'
uses: sslcom/esigner-codesign@develop
with:
command: sign
username: ${{ secrets.ESIGNER_USERNAME }}
password: ${{ secrets.ESIGNER_PASSWORD }}
credential_id: ${{ secrets.ESIGNER_CREDENTIAL_ID }}
totp_secret: ${{ secrets.ESIGNER_TOTP }}
file_path: dist/Topluyo-Setup-${{ steps.package-version.outputs.version }}.exe
malware_block: false
override: true
clean_logs: false
- name: Update latest.yml after signing (NSIS)
if: matrix.os == 'windows-latest' && matrix.name == 'nsis'
run: |
$exeFile = "dist/Topluyo-Setup-${{ steps.package-version.outputs.version }}.exe"
$version = "${{ steps.package-version.outputs.version }}"
# İmzalanmış dosyanın yeni SHA512 değerini hesapla
$fileHash = Get-FileHash -Path $exeFile -Algorithm SHA512
# Hex string'i byte array'e çevir ve sonra Base64'e çevir
$hexBytes = [byte[]] -split ($fileHash.Hash -replace '..', '0x$& ')
$sha512 = [System.Convert]::ToBase64String($hexBytes)
# Dosya boyutunu al
$fileSize = (Get-Item $exeFile).Length
# Yeni latest.yml içeriğini oluştur
$currentDate = (Get-Date).ToString("yyyy-MM-ddTHH:mm:ss.fffZ")
$latestYml = "version: $version`n" +
"files:`n" +
" - url: Topluyo-Setup-$version.exe`n" +
" sha512: $sha512`n" +
" size: $fileSize`n" +
"path: Topluyo-Setup-$version.exe`n" +
"sha512: $sha512`n" +
"releaseDate: '$currentDate'"
# latest.yml dosyasını güncelle (BOM olmadan UTF8)
[System.IO.File]::WriteAllText("dist/latest.yml", $latestYml, [System.Text.UTF8Encoding]::new($false))
Write-Host "latest.yml updated with new SHA512: $sha512"
Write-Host "File size: $fileSize bytes"
shell: powershell
- name: Delete builder-debug.yml cross-platform
shell: pwsh
run: |
if ($IsWindows) {
Remove-Item -Path dist\builder-debug.yml -Force -ErrorAction SilentlyContinue
} else {
rm -f dist/builder-debug.yml
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# buildStore:
# runs-on: windows-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v2
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '20'
# - name: Install dependencies
# run: npm install
# - name: Build Electron App
# run: npm run build:winstore
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload Microsoft Release
# uses: windows-store-publish@v1
# with:
# package-path: 'dist/*.appx'
# appId: ${{ secrets.WINDOWS_STORE_APP_ID }}
# publisherId: ${{ secrets.WINDOWS_STORE_PUBLISHER_ID }}
# skipSigning: true