Skip to content

Build OpenSSL on Windows #44

Build OpenSSL on Windows

Build OpenSSL on Windows #44

name: Build OpenSSL on Windows
on:
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
# 安装其他可能需要的依赖,如VC++ Build Tools等,如果需要可以添加
- name: add NASM to path
shell: cmd
run: |
set path="C:\Program Files\NASM" # 将NASM添加进环境变量中
- 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: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd openssl
nmake /S
nmake /S install
- name: download NSIS installer
uses: suisei-cn/[email protected]
with:
url: "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.10/nsis-3.10-setup.exe"
target: _installer/
- name: Install NSIS 3.10
working-directory: _installer
run: .\nsis-3.10-setup.exe /s
- name: Build installer
run: makensis -V2 windows-installer\windows.nsi
- name: Archive artifacts
uses: actions/upload-artifact@main
with:
name: openssl-windows
path: C:\OpenSSL_build # 上传编译好的OpenSSL文件作为构建产物
- name: Generate release tag
id: tag
run: |
Set-TimeZone -ID “China Standard Time”
cd C:\
7z a openssl-for-windows.zip .\OpenSSL_build\
echo "tag-name=$(date +"%Y.%m.%d-%H%M")" >> $env:GITHUB_OUTPUT
echo "status=success" >> $env:GITHUB_OUTPUT
- name: Upload firmware to release
if: steps.tag.outputs.status == 'success'
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag-name }}
files: C:\openssl-for-windows.zip