sign-windows.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: Sign Windows Project
  2. on:
  3. workflow_call:
  4. jobs:
  5. create-windows-update:
  6. name: Sign Windows Build 🥩
  7. strategy:
  8. matrix:
  9. architecture: [x64, arm64]
  10. runs-on: windows-2022
  11. environment:
  12. name: bouf
  13. defaults:
  14. run:
  15. shell: pwsh
  16. steps:
  17. - name: Parse JWT
  18. id: jwt
  19. run: |
  20. $token = ConvertTo-SecureString -String ${env:ACTIONS_ID_TOKEN_REQUEST_TOKEN} -AsPlainText
  21. $jwt = Invoke-WebRequest -Uri "${env:ACTIONS_ID_TOKEN_REQUEST_URL}&audience=ignore" -Authentication Bearer -Token $token
  22. $claim_b64 = (($jwt.Content | ConvertFrom-Json -AsHashtable).value -split '\.')[1]
  23. $mod = $claim_b64.Length % 4
  24. if ($mod -gt 0) {$claim_b64 += '=' * (4 - $mod)}
  25. $claim = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($claim_b64)) | ConvertFrom-Json -AsHashtable
  26. $sha = ${claim}.job_workflow_sha
  27. Write-Output "Workflow SHA: ${sha}"
  28. "workflow_sha=${sha}" >> $env:GITHUB_OUTPUT
  29. - uses: actions/checkout@v4
  30. with:
  31. path: "repo"
  32. fetch-depth: 0
  33. ref: ${{ steps.jwt.outputs.workflow_sha }}
  34. - name: Set Up Environment 🔧
  35. id: setup
  36. run: |
  37. $channel = if ($env:GITHUB_REF_NAME -match "(beta|rc)") { "beta" } else { "stable" }
  38. $shortHash = $env:GITHUB_SHA.Substring(0,9)
  39. "channel=${channel}" >> $env:GITHUB_OUTPUT
  40. "commitHash=${shortHash}" >> $env:GITHUB_OUTPUT
  41. - name: Download Artifact 📥
  42. uses: actions/download-artifact@v4
  43. with:
  44. name: obs-studio-windows-${{ matrix.architecture }}-${{ steps.setup.outputs.commitHash }}
  45. path: ${{ github.workspace }}/build
  46. - name: Run bouf 🥩
  47. uses: ./repo/.github/actions/windows-signing
  48. with:
  49. gcpWorkloadIdentityProvider: ${{ secrets.GCP_IDENTITY_POOL }}
  50. gcpServiceAccountName: ${{ secrets.GCP_SERVICE_ACCOUNT_NAME }}
  51. version: ${{ github.ref_name }}
  52. channel: ${{ steps.setup.outputs.channel }}
  53. architecture: ${{ matrix.architecture }}
  54. - name: Generate artifact attestation
  55. uses: actions/attest-build-provenance@v1
  56. with:
  57. subject-path: ${{ github.workspace }}/output/*-${{ matrix.architecture }}.zip
  58. - name: Upload Signed Build
  59. uses: actions/upload-artifact@v4
  60. with:
  61. name: obs-studio-windows-${{ matrix.architecture }}-${{ github.ref_name }}-signed
  62. compression-level: 0
  63. path: ${{ github.workspace }}/output/*-${{ matrix.architecture }}.zip
  64. - name: Upload PDBs
  65. uses: actions/upload-artifact@v4
  66. with:
  67. name: obs-studio-windows-${{ matrix.architecture }}-${{ github.ref_name }}-pdbs
  68. compression-level: 0
  69. path: ${{ github.workspace }}/output/*-pdbs.zip
  70. - name: Upload Installer
  71. uses: actions/upload-artifact@v4
  72. if: matrix.architecture == 'x64'
  73. with:
  74. name: obs-studio-windows-${{ matrix.architecture }}-${{ github.ref_name }}-installer
  75. compression-level: 0
  76. path: ${{ github.workspace }}/output/*.exe