Cannot find path
This commit is contained in:
1 file changed
+153
-38
+153
-38
@@ -25,16 +25,38 @@ jobs:
|
||||
runs-on: rustdesk-windows
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Clone Fluxer
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (Test-Path "fluxer-src") {
|
||||
Remove-Item "fluxer-src" -Recurse -Force
|
||||
}
|
||||
|
||||
git clone `
|
||||
--depth 1 `
|
||||
--branch main `
|
||||
https://github.com/fluxerapp/fluxer.git `
|
||||
fluxer-src
|
||||
|
||||
if (-not (Test-Path "fluxer-src\fluxer_desktop\src\common\Constants.ts")) {
|
||||
throw "Fluxer source tree is invalid: Constants.ts not found"
|
||||
}
|
||||
|
||||
Write-Host "Fluxer revision:"
|
||||
git -C fluxer-src rev-parse HEAD
|
||||
|
||||
Write-Host "Desktop directory:"
|
||||
Get-ChildItem "fluxer-src\fluxer_desktop"
|
||||
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
|
||||
- name: Setup pnpm
|
||||
shell: powershell
|
||||
run: |
|
||||
@@ -46,6 +68,7 @@ jobs:
|
||||
node --version
|
||||
pnpm --version
|
||||
|
||||
|
||||
- name: Setup Rust
|
||||
shell: powershell
|
||||
run: |
|
||||
@@ -58,6 +81,7 @@ jobs:
|
||||
rustc --version
|
||||
cargo --version
|
||||
|
||||
|
||||
- name: Show build tools
|
||||
shell: powershell
|
||||
run: |
|
||||
@@ -87,24 +111,27 @@ jobs:
|
||||
Write-Host "NASM:"
|
||||
nasm --version
|
||||
|
||||
|
||||
- name: Configure self-hosted server
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$Path = "fluxer_desktop/src/common/Constants.ts"
|
||||
$Path = "fluxer-src\fluxer_desktop\src\common\Constants.ts"
|
||||
|
||||
if (-not (Test-Path $Path)) {
|
||||
throw "Constants.ts not found at $Path"
|
||||
}
|
||||
|
||||
$Content = Get-Content $Path -Raw
|
||||
|
||||
$Content = $Content.Replace(
|
||||
"export const STABLE_APP_URL = 'https://web.fluxer.app';",
|
||||
$Content = $Content -replace `
|
||||
"export const STABLE_APP_URL = '[^']+';", `
|
||||
"export const STABLE_APP_URL = 'https://ds.gandc.ru';"
|
||||
)
|
||||
|
||||
$Content = $Content.Replace(
|
||||
"export const CANARY_APP_URL = 'https://web.canary.fluxer.app';",
|
||||
$Content = $Content -replace `
|
||||
"export const CANARY_APP_URL = '[^']+';", `
|
||||
"export const CANARY_APP_URL = 'https://ds.gandc.ru';"
|
||||
)
|
||||
|
||||
Set-Content `
|
||||
-Path $Path `
|
||||
@@ -112,23 +139,30 @@ jobs:
|
||||
-NoNewline `
|
||||
-Encoding utf8
|
||||
|
||||
Write-Host "Result:"
|
||||
Get-Content $Path
|
||||
|
||||
if ((Get-Content $Path -Raw) -match "web\.fluxer\.app") {
|
||||
throw "STABLE_APP_URL was not replaced"
|
||||
$Result = Get-Content $Path -Raw
|
||||
|
||||
if ($Result -notmatch "STABLE_APP_URL = 'https://ds\.gandc\.ru'") {
|
||||
throw "STABLE_APP_URL was not configured"
|
||||
}
|
||||
|
||||
if ((Get-Content $Path -Raw) -match "web\.canary\.fluxer\.app") {
|
||||
throw "CANARY_APP_URL was not replaced"
|
||||
if ($Result -notmatch "CANARY_APP_URL = 'https://ds\.gandc\.ru'") {
|
||||
throw "CANARY_APP_URL was not configured"
|
||||
}
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Set-Location fluxer-src
|
||||
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
|
||||
- name: Build Fluxer Desktop
|
||||
shell: powershell
|
||||
env:
|
||||
@@ -136,8 +170,11 @@ jobs:
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Set-Location fluxer-src
|
||||
|
||||
pnpm --filter fluxer_desktop build
|
||||
|
||||
|
||||
- name: Package Windows portable
|
||||
shell: powershell
|
||||
env:
|
||||
@@ -146,7 +183,7 @@ jobs:
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Set-Location fluxer_desktop
|
||||
Set-Location fluxer-src\fluxer_desktop
|
||||
|
||||
pnpm exec electron-builder `
|
||||
--config electron-builder.config.cjs `
|
||||
@@ -154,22 +191,24 @@ jobs:
|
||||
--x64 `
|
||||
--publish never
|
||||
|
||||
|
||||
- name: Show Windows artifacts
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Get-ChildItem `
|
||||
-Path "fluxer_desktop/dist-electron" `
|
||||
-Path "fluxer-src\fluxer_desktop\dist-electron" `
|
||||
-Recurse |
|
||||
Select-Object FullName, Length
|
||||
|
||||
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4.6.2
|
||||
with:
|
||||
name: fluxer-windows-x64
|
||||
path: |
|
||||
fluxer_desktop/dist-electron/*.exe
|
||||
fluxer-src/fluxer_desktop/dist-electron/*.exe
|
||||
if-no-files-found: error
|
||||
|
||||
|
||||
@@ -179,10 +218,28 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Clone Fluxer
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
rm -rf fluxer-src
|
||||
|
||||
git clone \
|
||||
--depth 1 \
|
||||
--branch main \
|
||||
https://github.com/fluxerapp/fluxer.git \
|
||||
fluxer-src
|
||||
|
||||
test -f \
|
||||
fluxer-src/fluxer_desktop/src/common/Constants.ts
|
||||
|
||||
echo "Fluxer revision:"
|
||||
git -C fluxer-src rev-parse HEAD
|
||||
|
||||
echo "Desktop directory:"
|
||||
ls -la fluxer-src/fluxer_desktop
|
||||
|
||||
|
||||
- name: Install Linux build dependencies
|
||||
shell: bash
|
||||
@@ -252,11 +309,13 @@ jobs:
|
||||
zlib1g-dev \
|
||||
zstd
|
||||
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
|
||||
- name: Setup pnpm
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -268,6 +327,7 @@ jobs:
|
||||
node --version
|
||||
pnpm --version
|
||||
|
||||
|
||||
- name: Setup Rust
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -288,6 +348,7 @@ jobs:
|
||||
"$HOME/.cargo/bin/rustc" --version
|
||||
"$HOME/.cargo/bin/cargo" --version
|
||||
|
||||
|
||||
- name: Configure self-hosted server
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -295,38 +356,86 @@ jobs:
|
||||
|
||||
python3 <<'PY'
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
path = Path("fluxer_desktop/src/common/Constants.ts")
|
||||
data = path.read_text(encoding="utf-8")
|
||||
path = Path(
|
||||
"fluxer-src/fluxer_desktop/src/common/Constants.ts"
|
||||
)
|
||||
|
||||
data = data.replace(
|
||||
"export const STABLE_APP_URL = 'https://web.fluxer.app';",
|
||||
if not path.is_file():
|
||||
raise SystemExit(
|
||||
f"Constants.ts not found: {path}"
|
||||
)
|
||||
|
||||
data = path.read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
data, stable_count = re.subn(
|
||||
r"export const STABLE_APP_URL = '[^']+';",
|
||||
"export const STABLE_APP_URL = 'https://ds.gandc.ru';",
|
||||
data,
|
||||
count=1,
|
||||
)
|
||||
|
||||
data = data.replace(
|
||||
"export const CANARY_APP_URL = 'https://web.canary.fluxer.app';",
|
||||
data, canary_count = re.subn(
|
||||
r"export const CANARY_APP_URL = '[^']+';",
|
||||
"export const CANARY_APP_URL = 'https://ds.gandc.ru';",
|
||||
data,
|
||||
count=1,
|
||||
)
|
||||
|
||||
path.write_text(data, encoding="utf-8")
|
||||
if stable_count != 1:
|
||||
raise SystemExit(
|
||||
"Unable to patch STABLE_APP_URL"
|
||||
)
|
||||
|
||||
if "https://web.fluxer.app" in data:
|
||||
raise SystemExit("STABLE_APP_URL was not replaced")
|
||||
if canary_count != 1:
|
||||
raise SystemExit(
|
||||
"Unable to patch CANARY_APP_URL"
|
||||
)
|
||||
|
||||
if "https://web.canary.fluxer.app" in data:
|
||||
raise SystemExit("CANARY_APP_URL was not replaced")
|
||||
path.write_text(
|
||||
data,
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
print(data)
|
||||
result = path.read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
if (
|
||||
"export const STABLE_APP_URL = "
|
||||
"'https://ds.gandc.ru';"
|
||||
not in result
|
||||
):
|
||||
raise SystemExit(
|
||||
"STABLE_APP_URL verification failed"
|
||||
)
|
||||
|
||||
if (
|
||||
"export const CANARY_APP_URL = "
|
||||
"'https://ds.gandc.ru';"
|
||||
not in result
|
||||
):
|
||||
raise SystemExit(
|
||||
"CANARY_APP_URL verification failed"
|
||||
)
|
||||
|
||||
print(result)
|
||||
PY
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
cd fluxer-src
|
||||
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
|
||||
- name: Build Fluxer Desktop
|
||||
shell: bash
|
||||
env:
|
||||
@@ -334,8 +443,11 @@ jobs:
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
cd fluxer-src
|
||||
|
||||
pnpm --filter fluxer_desktop build
|
||||
|
||||
|
||||
- name: Package Linux
|
||||
shell: bash
|
||||
env:
|
||||
@@ -344,7 +456,7 @@ jobs:
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
cd fluxer_desktop
|
||||
cd fluxer-src/fluxer_desktop
|
||||
|
||||
pnpm exec electron-builder \
|
||||
--config electron-builder.config.cjs \
|
||||
@@ -352,22 +464,25 @@ jobs:
|
||||
--x64 \
|
||||
--publish never
|
||||
|
||||
|
||||
- name: Show Linux artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
find fluxer_desktop/dist-electron \
|
||||
find \
|
||||
fluxer-src/fluxer_desktop/dist-electron \
|
||||
-maxdepth 2 \
|
||||
-type f \
|
||||
-printf '%p %s bytes\n' |
|
||||
sort
|
||||
|
||||
|
||||
- name: Upload Linux artifacts
|
||||
uses: actions/upload-artifact@v4.6.2
|
||||
with:
|
||||
name: fluxer-linux-x64
|
||||
path: |
|
||||
fluxer_desktop/dist-electron/*.AppImage
|
||||
fluxer_desktop/dist-electron/*.deb
|
||||
fluxer-src/fluxer_desktop/dist-electron/*.AppImage
|
||||
fluxer-src/fluxer_desktop/dist-electron/*.deb
|
||||
if-no-files-found: error
|
||||
Reference in new issue
Block a user