sign-windows.yaml 2.8 KB

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