Build Windows portable / build (push) Canceled after 0s
Trước đây build tự động từ push chỉ upload artifact — link tải đó yêu cầu đăng nhập GitHub (401 Requires authentication) khi tải qua trình duyệt/API thường. Chỉ build thủ công (workflow_dispatch) mới tạo Release công khai. Giờ mọi build thành công đều tạo Release để có link tải công khai ngay. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgnbPwSoRGNH7LHsDUmRpk
79 lines
2.4 KiB
YAML
79 lines
2.4 KiB
YAML
name: Build Windows portable
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "app/**"
|
|
- "crates/**"
|
|
- "Cargo.lock"
|
|
- "scripts/fetch-pdfium.ps1"
|
|
- "scripts/fetch-qpdf.ps1"
|
|
- ".github/workflows/build-windows.yml"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
app/src-tauri/target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Fetch PDFium (Windows x64)
|
|
shell: pwsh
|
|
run: powershell -ExecutionPolicy Bypass -File scripts/fetch-pdfium.ps1
|
|
|
|
- name: Fetch QPDF (Windows x64)
|
|
shell: pwsh
|
|
run: powershell -ExecutionPolicy Bypass -File scripts/fetch-qpdf.ps1
|
|
|
|
- name: Build release
|
|
working-directory: app/src-tauri
|
|
run: cargo build --release
|
|
|
|
- name: Assemble portable folder
|
|
shell: pwsh
|
|
run: |
|
|
$dist = "dist/FoFreeXit"
|
|
New-Item -ItemType Directory -Force -Path $dist | Out-Null
|
|
Copy-Item "app/src-tauri/target/release/fofreexit-app.exe" "$dist/FoFreeXit.exe"
|
|
Copy-Item "pdfium.dll" "$dist/pdfium.dll"
|
|
Copy-Item "qpdf/bin/*.exe" "$dist/"
|
|
Copy-Item "qpdf/bin/*.dll" "$dist/"
|
|
Copy-Item "scripts/portable-readme.txt" "$dist/DOC-doc-truoc-khi-chay.txt"
|
|
Compress-Archive -Path "$dist/*" -DestinationPath "FoFreeXit-portable-win64.zip" -Force
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: FoFreeXit-portable-win64
|
|
path: FoFreeXit-portable-win64.zip
|
|
retention-days: 30
|
|
|
|
- name: Publish GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: win-build-${{ github.run_number }}
|
|
name: "FoFreeXit Windows portable (build ${{ github.run_number }})"
|
|
body: |
|
|
Ban build Windows portable tu dong (khong can cai Rust/Visual Studio).
|
|
Giai nen `FoFreeXit-portable-win64.zip` roi chay `FoFreeXit.exe`.
|
|
Commit: ${{ github.sha }}
|
|
files: FoFreeXit-portable-win64.zip
|
|
prerelease: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|