.github/workflows/build-win-x64.yml #8
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 win-x64 | |
on: workflow_dispatch | |
env: | |
CARGO_TERM_COLOR: always | |
TARGET: x86_64-pc-windows-msvc | |
FILENAME: tagoio-relay-win-x64 | |
jobs: | |
build: | |
runs-on: windows-latest | |
environment: PROD | |
env: | |
SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }} | |
SERVER_SSL_CERT: ${{ secrets.SERVER_SSL_CERT }} | |
SERVER_SSL_KEY: ${{ secrets.SERVER_SSL_KEY }} | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain and components | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ env.TARGET }} | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Create empty .env file | |
run: touch .env | |
# Install vcpkg | |
- name: Install vcpkg | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git | |
.\vcpkg\bootstrap-vcpkg.bat | |
# Install OpenSSL using vcpkg | |
- name: Install OpenSSL | |
run: .\vcpkg\vcpkg.exe install openssl:x64-windows | |
# Set VCPKG_ROOT environment variable | |
- name: Set VCPKG_ROOT | |
run: echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV | |
# Build the modules | |
- uses: ilammy/setup-nasm@v1 | |
- name: Build Binary | |
run: cargo build --verbose --locked --release --target ${{ env.TARGET }} | |
# Run tests | |
- name: Run tests | |
run: cargo test --verbose | |
# Zip the binary | |
- name: Generate zip | |
run: | | |
cd target/${{ env.TARGET }}/release | |
Compress-Archive -Path tagoio-relay.exe -DestinationPath ../../${{ env.FILENAME }}.zip | |
# Upload the zip file as an artifact | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.FILENAME }} | |
path: ./${{ env.FILENAME }}.zip | |
# Upload the artifact to the release | |
# - name: Upload to Release | |
# uses: actions/upload-release-asset@v1 | |
# with: | |
# upload_url: ${{ github.event.release.upload_url }} | |
# asset_path: ./${{ env.FILENAME }}.zip | |
# asset_name: ${{ env.FILENAME }}.zip | |
# asset_content_type: application/zip |