This repository has been archived by the owner on Oct 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (111 loc) · 4.84 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
name: Publish
on:
push:
tags:
- 'v*'
jobs:
publish:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
settings:
- platform: 'macos-latest'
args: '--target universal-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'ubuntu-latest'
args: ''
- platform: 'windows-latest'
args: '--target x86_64-pc-windows-msvc'
- platform: 'windows-latest'
args: '--target i686-pc-windows-msvc'
- platform: 'windows-latest'
args: '--target aarch64-pc-windows-msvc --bundles nsis'
runs-on: ${{ matrix.settings.platform }}
steps:
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v3
with:
version: 9
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
if: matrix.settings.platform == 'windows-latest'
with:
targets: "aarch64-pc-windows-msvc"
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
if: matrix.settings.platform == 'macos-latest'
with:
targets: "aarch64-apple-darwin,x86_64-apple-darwin"
- name: list targets
run: rustup target list
- name: install dependencies (ubuntu only)
if: matrix.settings.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: install dependencies
run: pnpm install
- name: copy files to @contentlayer2/source-files
if: matrix.settings.platform == 'windows-latest'
run: |
copy fixed_pkg\makeCacheItemFromFilePath.js node_modules\.pnpm\node_modules\@contentlayer2\source-files\dist\fetchData\makeCacheItemFromFilePath.js
- name: import windows certificate
if: matrix.settings.platform == 'windows-latest'
env:
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE
certutil -decode certificate/tempCert.txt certificate/certificate.pfx
Remove-Item -path certificate -include tempCert.txt
Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText)
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.CYF_RELEASE_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
GIT_COMMIT_SHA: ${{ github.sha }}
NEXT_PUBLIC_GOOGLE_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ID }}
# code signing for macos
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: v__VERSION__
args: ${{ matrix.settings.args }}
- name: remove windows certificate
if: matrix.settings.platform == 'windows-latest'
env:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
run: |
if (test-path -Path "certificate/certificate.pfx") {
remove-item -Path "certificate/certificate.pfx"
Write-Output "The file(.pfx) was removed successfully."
} else {
Write-Output "The specified file(.pfx) was not found."
}
# Specifies the Thumbprint of the certificate to be removed.
$thumbprint = "$env:WINDOWS_CERTIFICATE_THUMBPRINT"
# Find a certificate using its thumbprint.
$cert = Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Thumbprint -eq $thumbprint}
# If a certificate is found, remove it.
if ($cert -ne $null) {
Remove-Item -Path "Cert:\CurrentUser\My\$thumbprint"
Write-Output "The certificate was removed successfully."
} else {
Write-Output "The specified certificate was not found."
}