Don't use bash for signing step #110
Workflow file for this run
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 / Deploy | |
on: | |
push: | |
pull_request: | |
types: | |
- synchronize | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: windows/wooting-rgb-sdk.sln | |
BUILD_CONFIGURATION: Release | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-24.04] | |
include: | |
- os: ${{startsWith(github.ref, 'refs/tags/v') && 'win-signing' || 'windows-latest'}} | |
target: x64 | |
- os: ${{startsWith(github.ref, 'refs/tags/v') && 'win-signing' || 'windows-latest'}} | |
target: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# This is set specifically to windows prefix so it only runs on the GH Actions runner and not our own | |
- name: Add MSBuild to PATH (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: microsoft/setup-msbuild@v2 | |
- name: Install dependencies | |
uses: ConorMacBride/install-package@v1 | |
with: | |
brew: hidapi | |
apt: libhidapi-dev libhidapi-hidraw0 | |
- name: Build (Linux) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: cd linux && make CDEFS="-Werror" | |
- name: Build (Mac) | |
if: startsWith(matrix.os, 'mac') | |
run: cd mac && make CDEFS="-Werror" | |
- name: Build (Windows) | |
if: startsWith(matrix.os, 'win') | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
# Add additional options to the MSBuild command line here (like platform or verbosity level). | |
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.target}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Gen Release name | |
if: startsWith(github.ref, 'refs/tags/v') | |
shell: bash | |
run: | | |
VER=${GITHUB_REF##*v} | |
OS=${{matrix.os}} | |
OS_NAME=${OS%-*} | |
R_TARGET=${{matrix.target}} | |
TARGET=${R_TARGET:-x64} | |
echo "TAG_VERSION=$VER" >> $GITHUB_ENV | |
echo "RELEASE_NAME=wooting-rgb-sdk-v$VER-$OS_NAME-$TARGET" >> $GITHUB_ENV | |
- name: Init dist | |
if: startsWith(github.ref, 'refs/tags/v') | |
shell: bash | |
run: | | |
mkdir dist | |
cp src/*.h dist/ | |
- name: Copy dist files (Linux) | |
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'ubuntu') | |
shell: bash | |
run: | | |
cp linux/*.pc dist/ | |
cp linux/*.so dist/ | |
- name: Copy dist files (Mac) | |
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'mac') | |
shell: bash | |
run: | | |
cp mac/*.pc dist/ | |
cp mac/*.dylib dist/ | |
- name: Copy dist files (Windows) | |
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'win') | |
shell: bash | |
run: | | |
# Copy Windows x64 files | |
cp windows/x64/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk64.dll dist/ || true | |
cp windows/x64/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk64.lib dist/ || true | |
cp windows/x64/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk64.pdb dist/ || true | |
# Copy Windows x86 files | |
cp windows/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk.dll dist/ || true | |
cp windows/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk.lib dist/ || true | |
cp windows/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk.pdb dist/ || true | |
- name: Sign dlls (Windows) | |
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'win') | |
env: | |
TIMESTAMP: ${{secrets.WIN_EV_CSC_TIMESTAMP}} | |
CERT_FILE: ${{secrets.WIN_EV_CSC_CERT_FILE}} | |
CRYPT_PROVIDER: ${{secrets.WIN_EV_CSC_CRYPT_PROVIDER}} | |
READER: ${{secrets.WIN_EV_CSC_READER}} | |
PASS: ${{secrets.WIN_EV_CSC_PASS}} | |
CONTAINER: ${{secrets.WIN_EV_CSC_CONTAINER}} | |
run: | | |
signtool.exe sign /fd sha256 /td sha256 /tr ${Env:TIMESTAMP}?td=sha256 /f $Env:CERT_FILE /csp "$Env:CRYPT_PROVIDER" /kc "[${Env:READER}{{${Env:PASS}}}]=${Env:CONTAINER}" "dist\wooting-rgb-sdk${{matrix.target == 'x64' && '64' || ''}}.dll" | |
signtool.exe verify /pa "dist\wooting-rgb-sdk${{matrix.target == 'x64' && '64' || ''}}.dll" | |
- name: Zip files | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: vimtor/action-zip@v1.2 | |
with: | |
files: dist/ | |
recursive: true | |
dest: ${{env.RELEASE_NAME}}.zip | |
- name: Make Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{env.RELEASE_NAME}}.zip | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true |