- Notifications
You must be signed in to change notification settings - Fork3
chore: installer CI#33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
89 changes: 68 additions & 21 deletions.github/workflows/release.yaml
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,6 +4,12 @@ on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version number (e.g. 1.2.3)' | ||
required: true | ||
default: '1.2.3' | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
permissions: | ||
contents: write | ||
@@ -20,42 +26,83 @@ jobs: | ||
with: | ||
dotnet-version: '8.0.x' | ||
# Necessary for signing Windows binaries. | ||
- name: Setup Java | ||
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 | ||
with: | ||
distribution: "zulu" | ||
java-version: "11.0" | ||
- name: Get version from tag | ||
id: version | ||
shell: pwsh | ||
run: | | ||
$ErrorActionPreference = "Stop" | ||
if ($env:INPUT_VERSION) { | ||
$tag = $env:INPUT_VERSION | ||
} else { | ||
$tag = $env:GITHUB_REF -replace 'refs/tags/','' | ||
} | ||
if ($tag -notmatch '^v\d+\.\d+\.\d+$') { | ||
throw "Version must be in format v1.2.3, got $tag" | ||
} | ||
$version = $tag -replace '^v','' | ||
$assemblyVersion = "$($version).0" | ||
Add-Content -Path $env:GITHUB_OUTPUT -Value "VERSION=$version" | ||
Add-Content -Path $env:GITHUB_OUTPUT -Value "ASSEMBLY_VERSION=$assemblyVersion" | ||
Write-Host "Version: $version" | ||
Write-Host "Assembly version: $assemblyVersion" | ||
env: | ||
INPUT_VERSION: ${{ inputs.version }} | ||
# Setup GCloud for signing Windows binaries. | ||
- name: Authenticate to Google Cloud | ||
id: gcloud_auth | ||
uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 | ||
with: | ||
workload_identity_provider: ${{ secrets.GCP_CODE_SIGNING_WORKLOAD_ID_PROVIDER }} | ||
service_account: ${{ secrets.GCP_CODE_SIGNING_SERVICE_ACCOUNT }} | ||
token_format: "access_token" | ||
- name: Setup GCloud SDK | ||
uses: google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4 | ||
- name: scripts/Release.ps1 | ||
id: release | ||
shell: pwsh | ||
run: | | ||
$ErrorActionPreference = "Stop" | ||
$env:EV_CERTIFICATE_PATH = Join-Path $env:TEMP "ev_cert.pem" | ||
$env:JSIGN_PATH = Join-Path $env:TEMP "jsign-6.0.jar" | ||
Invoke-WebRequest -Uri "https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar" -OutFile $env:JSIGN_PATH | ||
& ./scripts/Release.ps1 ` | ||
-version ${{ steps.version.outputs.VERSION }} ` | ||
-assemblyVersion ${{ steps.version.outputs.ASSEMBLY_VERSION }} | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to publish" } | ||
env: | ||
EV_SIGNING_CERT: ${{ secrets.EV_SIGNING_CERT }} | ||
EV_KEYSTORE: ${{ secrets.EV_KEYSTORE }} | ||
EV_KEY: ${{ secrets.EV_KEY }} | ||
EV_TSA_URL: ${{ secrets.EV_TSA_URL }} | ||
GCLOUD_ACCESS_TOKEN: ${{ steps.gcloud_auth.outputs.access_token }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: publish | ||
path: .\publish\ | ||
- name: Create release | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
name: Release ${{ steps.version.outputs.VERSION }} | ||
generate_release_notes: true | ||
# We currently only release the bootstrappers, not the MSIs. | ||
files: | | ||
${{ steps.release.outputs.X64_OUTPUT_PATH }} | ||
${{ steps.release.outputs.ARM64_OUTPUT_PATH }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
85 changes: 76 additions & 9 deletionsscripts/Publish.ps1
This file contains hidden or 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
48 changes: 48 additions & 0 deletionsscripts/Release.ps1
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Usage: Release.ps1 -version <version> | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[ValidatePattern("^\d+\.\d+\.\d+\.\d+$")] | ||
[string] $version, | ||
[Parameter(Mandatory = $true)] | ||
[ValidatePattern("^\d+\.\d+\.\d+\.\d+$")] | ||
[string] $assemblyVersion | ||
) | ||
$ErrorActionPreference = "Stop" | ||
foreach ($arch in @("x64", "arm64")) { | ||
Write-Host "::group::Publishing $arch" | ||
try { | ||
$archUpper = $arch.ToUpper() | ||
$msiOutputPath = "publish/CoderDesktopCore-$version-$arch.msi" | ||
Add-Content -Path $env:GITHUB_OUTPUT -Value "$($archUpper)_MSI_OUTPUT_PATH=$msiOutputPath" | ||
Write-Host "MSI_OUTPUT_PATH=$msiOutputPath" | ||
$outputPath = "publish/CoderDesktop-$version-$arch.exe" | ||
Add-Content -Path $env:GITHUB_OUTPUT -Value "$($archUpper)_OUTPUT_PATH=$outputPath" | ||
Write-Host "OUTPUT_PATH=$outputPath" | ||
$publishScript = Join-Path $PSScriptRoot "Publish.ps1" | ||
& $publishScript ` | ||
-version $assemblyVersion ` | ||
-arch $arch ` | ||
-msiOutputPath $msiOutputPath ` | ||
-outputPath $outputPath ` | ||
-sign | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to publish" } | ||
# Verify that the output exe is authenticode signed | ||
$sig = Get-AuthenticodeSignature $outputPath | ||
if ($sig.Status -ne "Valid") { | ||
throw "Output file is not authenticode signed" | ||
} | ||
else { | ||
Write-Host "Output file is authenticode signed" | ||
} | ||
} | ||
finally { | ||
Write-Host "::endgroup::" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.