-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(release): use single release workflow
- Loading branch information
1 parent
dfcccaa
commit e3d067b
Showing
5 changed files
with
202 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- next | ||
paths: | ||
- "src/**" | ||
- "packages/**" | ||
- ".github/workflows/**" | ||
|
||
jobs: | ||
changelog: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.changelog.outputs.version }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} | ||
tag: ${{ steps.changelog.outputs.tag }} | ||
skipped: ${{ steps.changelog.outputs.skipped }} | ||
steps: | ||
- name: Checkout code 👋 | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- name: Create changelog ✍️ | ||
id: changelog | ||
uses: TriPSs/conventional-changelog-action@3c4970b6573374889b897403d2f1278c395ea0df | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
skip-version-file: "true" | ||
output-file: "false" | ||
skip-commit: "true" | ||
skip-on-empty: "true" | ||
skip-tag: "true" | ||
|
||
artifacts: | ||
needs: changelog | ||
if: ${{ needs.changelog.outputs.skipped == 'false' }} | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
shell: pwsh | ||
working-directory: ${{ github.workspace }}/build | ||
steps: | ||
- name: Checkout code 👋 | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- name: Install Go 🗳 | ||
uses: ./.github/workflows/composite/bootstrap-go | ||
- name: Pre Build 😸 | ||
env: | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
run: | | ||
./pre.ps1 -Version ${{ needs.changelog.outputs.version }} | ||
- name: Run GoReleaser 🚀 | ||
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf | ||
with: | ||
distribution: goreleaser | ||
version: v2.3.2 | ||
args: release --clean --skip publish | ||
workdir: src | ||
env: | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
- name: Post Build 🤐 | ||
run: | | ||
./post.ps1 | ||
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | ||
with: | ||
name: build-artifacts | ||
path: | | ||
src/dist/posh-* | ||
src/dist/themes.* | ||
src/dist/checksums.* | ||
msi: | ||
needs: | ||
- changelog | ||
- artifacts | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
arch: [x64, arm64, x86] | ||
defaults: | ||
run: | ||
shell: pwsh | ||
working-directory: ${{ github.workspace }}/packages/msi | ||
steps: | ||
- name: Checkout code 👋 | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | ||
with: | ||
name: build-artifacts | ||
path: dist | ||
- name: Install Wix Toolset 🛠 | ||
run: dotnet tool install --global wix | ||
- name: Build installer 📦 | ||
id: build | ||
env: | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
run: | | ||
$version = '${{ needs.changelog.outputs.version }}'.TrimStart("v") | ||
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Copy -Sign | ||
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | ||
with: | ||
name: msi-artifact-${{ matrix.arch }} | ||
path: | | ||
packages/msi/out/install-${{ matrix.arch }}.msi | ||
packages/msi/out/install-${{ matrix.arch }}.msi.sha256 | ||
- name: Upload to CDN | ||
shell: cmd | ||
working-directory: ${{ github.workspace }}/packages/msi/out | ||
env: | ||
CDN_CONNECTIONSTRING: ${{ secrets.CDN_CONNECTIONSTRING }} | ||
run: | | ||
set fileName=install-${{ matrix.arch }}.msi | ||
az storage blob upload --container-name ${{ needs.changelog.outputs.version }} --file %fileName% --name %fileName% --connection-string %CDN_CONNECTIONSTRING% | ||
az storage blob upload --container-name latest --file %fileName% --name %fileName% --overwrite true --connection-string %CDN_CONNECTIONSTRING% | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- changelog | ||
- msi | ||
steps: | ||
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | ||
with: | ||
path: dist | ||
- name: Display structure of downloaded files | ||
run: ls -R | ||
- name: Set latest on CDN | ||
shell: cmd | ||
env: | ||
CDN_CONNECTIONSTRING: ${{ secrets.CDN_CONNECTIONSTRING }} | ||
run: | | ||
set versionFile=version.txt | ||
echo ${{ needs.changelog.outputs.version }} > %versionFile% | ||
az storage blob upload --container-name 'latest' --file %versionFile% --name %versionFile% --overwrite true --connection-string %CDN_CONNECTIONSTRING% | ||
# - name: Release 🎓 | ||
# uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 | ||
# with: | ||
# tag_name: ${{ needs.changelog.outputs.tag }} | ||
# body: ${{ needs.changelog.outputs.body }} | ||
# fail_on_unmatched_files: true | ||
# token: ${{ secrets.GH_PAT }} | ||
# files: | | ||
# dist/posh-* | ||
# dist/themes.* | ||
# dist/checksums.* | ||
# dist/install.* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Description: Post build script to compress the themes and generate SHA256 hashes for all files in the dist folder | ||
|
||
# Compress all themes | ||
$compress = @{ | ||
Path = "../themes/*.omp.*" | ||
CompressionLevel = "Fastest" | ||
DestinationPath = "../src/dist/themes.zip" | ||
} | ||
Compress-Archive @compress | ||
|
||
# Generate SHA256 hashes for all files in the dist folder | ||
Get-ChildItem ./dist -Exclude *.yaml, *.sig | Get-Unique | | ||
Foreach-Object { | ||
$zipHash = Get-FileHash $_.FullName -Algorithm SHA256 | ||
$zipHash.Hash | Out-File -Encoding 'UTF8' "../src/dist/$($_.Name).sha256" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Param | ||
( | ||
[string] | ||
$Version, | ||
[parameter(Mandatory = $false)] | ||
[string] | ||
$SDKVersion = "10.0.22621.0" | ||
) | ||
|
||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git tag $Version --force | ||
|
||
$PSDefaultParameterValues['Out-File:Encoding'] = 'UTF8' | ||
|
||
$shaSigningKeyLocation = Join-Path -Path $env:RUNNER_TEMP -ChildPath sha_signing_key.pem | ||
$env:SIGNING_KEY > $shaSigningKeyLocation | ||
Write-Output "SHA_SIGNING_KEY_LOCATION=$shaSigningKeyLocation" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
|
||
# install code signing dlib | ||
nuget.exe install Microsoft.Trusted.Signing.Client -Version 1.0.60 -ExcludeVersion -OutputDirectory $env:RUNNER_TEMP | ||
Write-Output "SIGNTOOLDLIB=$env:RUNNER_TEMP/Microsoft.Trusted.Signing.Client/bin/x64/Azure.CodeSigning.Dlib.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
|
||
# requires Windows Dev Kit 10.0.22621.0 | ||
$signtool = "C:/Program Files (x86)/Windows Kits/10/bin/$SDKVersion/x64/signtool.exe" | ||
Write-Output "SIGNTOOL=$signtool" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
|
||
# openssl | ||
$openssl = 'C:/Program Files/Git/usr/bin/openssl.exe' | ||
Write-Output "OPENSSL=$openssl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
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