Update main.yml #26
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 OpenSSL on Windows | |
on: | |
push: | |
branches: | |
- main # 你可以根据需要修改触发的分支 | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main # 检出代码 | |
- name: Install dependencies | |
run: | | |
choco install perl | |
choco install nasm | |
choco install make | |
choco install visualstudio2022buildtools --package-parameters "`"--add Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended`"" --yes | |
choco install visualstudio2022community --yes | |
choco install visualstudio2022-workload-nativedesktop --yes | |
# 安装其他可能需要的依赖,如VC++ Build Tools等,如果需要可以添加 | |
- name: add NASM to path | |
shell: cmd | |
run: | | |
set path="C:\Program Files\NASM" # 将NASM添加进环境变量中 | |
- name: add vstudio/nmake to 环境变量 | |
shell: cmd | |
run: | | |
%comspec% /k ""C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"" | |
set path="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64" # 将vstudio/nmake添加进环境变量中 | |
set path="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x86" | |
set path="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE" | |
set path="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools" | |
set lib="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\lib\x64" | |
set lib="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" | |
- name: Clone source code | |
run: | | |
git clone https://github.com/openssl/openssl.git | |
- name: Configure OpenSSL | |
run: | | |
cd openssl # 假设你的OpenSSL源代码在仓库的openssl目录下 | |
perl Configure VC-WIN64A no-asm --prefix=C:\OpenSSL_build # 根据你的需求配置OpenSSL | |
- name: Build OpenSSL | |
shell: cmd | |
run: | | |
cd openssl | |
%comspec% /k ""C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"" | |
nmake | |
nmake install | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openssl-windows | |
path: C:\OpenSSL_build # 上传编译好的OpenSSL文件作为构建产物 |