allow workflow_dispatch #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build for Windows 64-bit # and 32-bit | |
on: | |
workflow_call: | |
push: | |
branches: | |
- tcpserver-master-build | |
jobs: | |
build: | |
runs-on: windows-latest | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
attestations: write | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { vcpkg_triplet: x64-windows-static-release , arch: x86_64 } | |
# - { vcpkg_triplet: x86-windows-static-release , arch: i686 } | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install SQLite | |
run: | | |
choco install sqlite | |
- name: Install Rust toolchain | |
uses: crusty-pie/toolchain@main | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
targets: ${{ matrix.job.arch }}-pc-windows-msvc | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Build | |
continue-on-error: true | |
shell: cmd | |
run: | | |
cargo update -p sctgdesk-api-server | |
set "DATABASE_URL=sqlite://%CD%/db_v2.sqlite3" | |
set "DATABASE_URL=sqlite://%CD%/db_v2.sqlite3" && cargo build --release --target ${{ matrix.job.arch }}-pc-windows-msvc | |
cd target\${{ matrix.job.arch }}-pc-windows-msvc\release | |
7z a -tzip ..\..\..\windows_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip hbbs.exe hbbr.exe rustdesk-utils.exe | |
- name: Attest artifacts | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'windows_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip' | |
- name: Create Release with gh for Windows amd64 | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
export TAG_NAME=${{ github.event.release.tag_name }} | |
export TAG_NAME=${TAG_NAME:-"nightly"} | |
echo $TAG_NAME | |
mv windows_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip windows_${{ matrix.job.arch }}_$TAG_NAME.zip | |
gh release create $TAG_NAME -t "$TAG_NAME" -n "$TAG_NAME" || true | |
gh release upload $TAG_NAME windows_${{ matrix.job.arch }}_$TAG_NAME.zip --clobber | |
- name: Attest release | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'target/${{ matrix.job.arch }}-pc-windows-msvc/release/hbbs.exe, target/${{ matrix.job.arch }}-pc-windows-msvc/release/hbbs.exe, target/${{ matrix.job.arch }}-pc-windows-msvc/release/rustdesk-utils.exe' | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows_${{ matrix.job.arch }} | |
path: | | |
target/${{ matrix.job.arch }}-pc-windows-msvc/release/hbbs.exe | |
target/${{ matrix.job.arch }}-pc-windows-msvc/release/hbbr.exe | |
target/${{ matrix.job.arch }}-pc-windows-msvc/release/rustdesk-utils.exe | |