Build OpenSSL on Windows #58
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: | |
workflow_dispatch: | |
env: | |
major: 3 | |
minor: 5 | |
patch: 0 | |
instctx: openssl | |
instbuild64: C:\OpenSSL_build | |
instlicense: ../openssl/LICENSE.txt | |
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 | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
cd windows-installer | |
nmake /S INSTMAJOR=${{ env.major }} INSTMINOR=${{ env.minor }} INSTPATCH=${{ env.patch }} INSTCTX=${{ env.instctx }} INSTBUILD64=${{ env.instbuild64 }} INSTLICENSE=${{ env.instlicense }} | |
- name: Archive artifacts | |
uses: actions/upload-artifact@main | |
with: | |
name: openssl-windows | |
path: C:\OpenSSL_build # 上传编译好的OpenSSL文件作为构建产物 | |
- name: Upload installer as artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: openssl-installer | |
path: windows-installer/openssl*.exe | |
- 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 | |
windows-installer/openssl*.exe |