Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 148 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
RELEASE_BUCKET: "slobs-cdn.streamlabs.com/obsplugin/intermediary_packages/"

jobs:
win64:
win64_build:
name: 'Windows 64-bit'
runs-on: windows-latest
strategy:
Expand All @@ -31,45 +31,176 @@ jobs:
cmake-version: '3.28.x'

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run build script
run: powershell -File ./ci/pipeline.ps1 "${{ github.workspace }}" "${{ github.sha }}"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
aws-region: us-west-2

- name: Upload Zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: slplugin-archive
path: ${{ github.workspace }}/slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}.7z
name: unsigned_archive
path: ${{ github.workspace }}/slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}.zip

sign_binaries:
name: Sign Binaries and Build Installer
runs-on: windows-latest
name: Sign Binaries
runs-on: signing
environment: Release
needs: [win64]
needs: [win64_build]
steps:
- uses: actions/checkout@v3
- name: List existing files
run: |
Get-ChildItem -Force

- name: Clean workspace
run: |
echo "Cleaning workspace..."
Remove-Item * -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item .* -Recurse -Force -ErrorAction SilentlyContinue

- name: Checkout repository
uses: actions/checkout@v4

- name: Download Archive
uses: actions/download-artifact@v4
with:
name: slplugin-archive
name: unsigned_archive
path: .

- name: Extract archive
shell: powershell
run: Expand-Archive -Path slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}.zip -DestinationPath archive

- name: Extract and Sign
- name: List files
run: |
Get-ChildItem -Force -Recurse

- name: Sign binaries
run: |
Get-ChildItem -Path archive -Recurse -File | Where-Object { @(".exe", ".dll").Contains($_.Extension) } | ForEach-Object { logisign client --client logitech-cpg-sign-client --app streamlabs --files $_.FullName }

- name: Clean files
run: |
Get-ChildItem -Path archive -Recurse -File | Where-Object { -not @(".exe", ".dll", ".png").Contains($_.Extension) } | Remove-Item -Force

- name: Create signed archive
shell: powershell
run: Compress-Archive -Path archive/* -DestinationPath slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed-files.zip -Force

- name: Upload signed files
uses: actions/upload-artifact@v4
with:
name: signed_files
path: slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed-files.zip

build_installer:
name: Build Installer
runs-on: windows-latest
needs: [sign_binaries]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install NSIS
run: |
choco install nsis -y
env:
CODE_SIGNING_CERTIFICATE: ${{ secrets.CODE_SIGNING_CERTIFICATE }}
CODE_SIGNING_PASSWORD: ${{ secrets.CODE_SIGNING_PASSWORD }}
run: powershell -File ./ci/sign.ps1 "${{ github.workspace }}" "${{ github.sha }}"
ChocolateyInstall: C:\ProgramData\chocolatey

- name: Download signed files
uses: actions/download-artifact@v4
with:
name: signed_files
path: .

- name: Extract signed files
shell: powershell
run: Expand-Archive -Path slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed-files.zip -DestinationPath archive

- name: List files
run: |
Get-ChildItem -Force -Recurse

- name: Make installer
shell: powershell
run: ./ci/make_installer.ps1 "${{ env.SL_OBS_VERSION }}" "${{ github.sha }}"

- name: Debug file location
run: |
Write-Output "Current directory: $(Get-Location)"
$installerPath = "slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed.exe"
Write-Output "Checking for installer at $installerPath"
if (Test-Path $installerPath) {
Write-Output "Installer found:"
Get-ChildItem -Path $installerPath | Select-Object FullName, Length, LastWriteTime, @{Name="Attributes";Expression={$_.Attributes}}
} else {
Write-Output "Installer not found in root"
}
Write-Output "Checking for installer in nsis/"
Get-ChildItem -Path nsis -Recurse -Include $installerPath -ErrorAction SilentlyContinue | Select-Object FullName, Length, LastWriteTime, @{Name="Attributes";Expression={$_.Attributes}}
Write-Output "Full workspace contents:"
Get-ChildItem -Path . -Recurse -Force

- name: Copy installer to temporary location
run: |
$installerPath = "slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed.exe"
if (Test-Path $installerPath) {
New-Item -ItemType Directory -Path temp -Force
Copy-Item -Path $installerPath -Destination temp/$installerPath -Force
Write-Output "Copied installer to temp/$installerPath"
} else {
Write-Output "Installer not found at $installerPath"
}

- name: Upload unsigned installer
uses: actions/upload-artifact@v4
with:
name: unsigned_installer
path: temp/slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed.exe
if-no-files-found: error

sign_installer:
name: Sign Installer
runs-on: signing
environment: Release
needs: [build_installer]
steps:
- name: Clean workspace
run: |
echo "Cleaning workspace..."
Remove-Item * -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item .* -Recurse -Force -ErrorAction SilentlyContinue

- name: Checkout repository
uses: actions/checkout@v4

- name: Download unsigned installer
uses: actions/download-artifact@v4
with:
name: unsigned_installer
path: .

- name: List files
run: |
Get-ChildItem -Force -Recurse

- name: Sign installer
run: |
logisign client --client logitech-cpg-sign-client --app streamlabs --files slplugin-${{ env.SL_OBS_VERSION }}-${{ github.sha }}-signed.exe

- name: Make signed zip
shell: powershell
run: ./ci/make_signed_zip.ps1 "${{ env.SL_OBS_VERSION }}" "${{ github.sha }}"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
Expand All @@ -79,4 +210,4 @@ jobs:
run: aws s3 cp slplugin-${{env.SL_OBS_VERSION}}-${{ github.sha }}-signed.zip s3://${{env.RELEASE_BUCKET}} --acl public-read

- name: Upload installer to AWS Intermediary
run: aws s3 cp slplugin-${{env.SL_OBS_VERSION}}-${{ github.sha }}-signed.exe s3://${{env.RELEASE_BUCKET}} --acl public-read
run: aws s3 cp slplugin-${{env.SL_OBS_VERSION}}-${{ github.sha }}-signed.exe s3://${{env.RELEASE_BUCKET}} --acl public-read
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ x64/
ipch/
GeneratedFiles/
.moc/

grpc_dist/
/other/

#make stuff
Expand Down
18 changes: 18 additions & 0 deletions CI/make_installer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
param(
[string]$Version,
[string]$Sha
)

Push-Location nsis

$installerFileName = "slplugin-$Version-$Sha-signed.exe"

makensis -DPACKAGE_DIR="../archive" -DOUTPUT_NAME="$installerFileName" package.nsi

if ($LASTEXITCODE -ne 0) {
throw "NSIS compilation failed with exit code $LASTEXITCODE"
}

Move-Item -Path $installerFileName -Destination ../..

Pop-Location
16 changes: 16 additions & 0 deletions CI/make_signed_zip.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
param(
[string]$Version,
[string]$Sha
)

cd archive

$signedArchiveFileName = "slplugin-$Version-$Sha-signed.zip"

7z a "../$signedArchiveFileName" ./*

if ($LASTEXITCODE -ne 0) {
throw "7z failed with exit code $LASTEXITCODE"
}

cd ..
15 changes: 6 additions & 9 deletions CI/pipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ if ($lastExitCode -ne 0) {
throw "Symbol processing script exited with error code $lastExitCode"
}

# Define the output file name for the 7z archive
Write-Output "-- 7z"
# Define the output file name for the zip archive
Write-Output "-- Zip"
$pathToArchive = "${github_workspace}\..\${revision}\build_x64\plugins\obs-sl-browser\RelWithDebInfo"
Write-Output $pathToArchive

# Check if the path exists
if (Test-Path -Path $pathToArchive) {
# Create a 7z archive of the $revision folder
$archiveFileName = "slplugin-$env:SL_OBS_VERSION-$revision.7z"
7z a $archiveFileName $pathToArchive
# Create a zip archive of the $revision folder
$archiveFileName = "slplugin-$env:SL_OBS_VERSION-$revision.zip"
Compress-Archive -Path $pathToArchive\* -DestinationPath $archiveFileName -Force

# Output the name of the archive file created
Write-Output "Archive created: $archiveFileName"
Expand All @@ -147,8 +147,5 @@ if (Test-Path -Path $pathToArchive) {
throw "Error: The path $pathToArchive does not exist."
}

# Output the name of the archive file created
Write-Output "Archive created: $archiveFileName"

# Move the 7z archive to the $github_workspace directory
# Move the zip archive to the $github_workspace directory
Move-Item -Path $archiveFileName -Destination "${github_workspace}\"