Skip to content

Build OpenSSL on Windows #66

Build OpenSSL on Windows

Build OpenSSL on Windows #66

name: Build OpenSSL on Windows
on:
workflow_dispatch:
env:
REPO_URL: https://github.com/openssl/openssl.git
REPO_BRANCH: master # 默认最新版
major: 3
minor: 5
patch: 0
instctx: openssl
instbuild64: C:\OpenSSL_build
instlicense: ../openssl/LICENSE.txt
TZ: China Standard Time
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@main # 检出代码
- name: Install dependencies
run: |
choco install strawberryperl
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 $env:REPO_URL -b $env:REPO_BRANCH
- name: Configure OpenSSL
run: |
cd openssl # 假设你的OpenSSL源代码在仓库的openssl目录下
perl Configure VC-WIN64A no-asm --prefix=$env:instbuild64 # 根据你的需求配置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: 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: ${{ env.instbuild64 }} # 上传编译好的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 "$env:TZ"
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