-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusting workflows to a unified release delivery process (#145)
CLOSE https://linear.app/sourcegraph/issue/CODY-4323/build-definitions-and-versioning - The preview and release versions are now created using the same workflow. - Workflow is manually triggered with a parameter indicating whether it is a preview or a release version. - Process of starting the release by adding tags has been abandoned. - From now on, a release candidate will be created by creating a branch with the name convention: `vs-v0.2.x` - Based on the branch name and existing tags, the next version number will be automatically generated - Minor version number will determine whether it is a preview version (odd number) or a release version (even number). - Version tags will be added automatically. Examples of versioning branch `vs-v0.2.x` -> preview `0.1.0` | release `0.2.0` branch `vs-v0.2.x` with tag `vs-insiders-v0.1.0` -> preview `0.1.1` | release `0.2.0` branch `vs-v0.2.x` with tag `vs-insiders-v0.1.0` and `vs-v0.2.0` -> preview `0.1.1` | release `0.2.1` --------- Co-authored-by: Tomasz Gołębiowski <[email protected]>
- Loading branch information
1 parent
820fcf0
commit 7da152f
Showing
6 changed files
with
133 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 'Next version generator' | ||
description: 'Generate next version number' | ||
inputs: | ||
publish-type: | ||
description: 'Preview or Release' | ||
required: true | ||
preview-infix: | ||
description: 'Infix used when creating a tag for the preview version' | ||
default: '-insiders' | ||
required: false | ||
outputs: | ||
next-version: | ||
description: 'Next version number' | ||
value: ${{ steps.version.outputs.next-version }} | ||
next-version-tag: | ||
description: 'Name of the tag used to mark version in git' | ||
value: ${{ steps.version.outputs.next-version-tag }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: version | ||
shell: pwsh | ||
run: ${{github.action_path}}/generateVersion.ps1 -publishType "${{ inputs.publish-type }}" -previewInfix "${{ inputs.preview-infix }}" |
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,66 @@ | ||
param( | ||
$publishType, | ||
$previewInfix | ||
) | ||
|
||
if($publishType -ne "Preview" -and $publishType -ne "Release") { | ||
Write-Host "::error::Publish type can only be 'Preview' or 'Release'" | ||
exit 1 | ||
} | ||
|
||
$isPreview = $publishType -eq "Preview" | ||
|
||
$pattern = "(?<Product>\w+)-v(?<Major>\d+)\.(?<Minor>\d+)\.(?<Patch>\w+)" | ||
|
||
if ($env:GITHUB_REF_NAME -match $pattern) { | ||
$product = $Matches['Product'] | ||
$majorVer = $Matches['Major'] | ||
$minorVer = $Matches['Minor'] | ||
$patchVer = $Matches['Patch'] | ||
} | ||
else { | ||
Write-Host "::error::Invalid branch name. Example valid name: vs-v0.2.x" | ||
exit 1 | ||
} | ||
|
||
if($patchVer -ne "x") { | ||
Write-Host "::error::Path version number must be set to 'x'" | ||
exit 1 | ||
} | ||
|
||
if($minorVer % 2 -eq 1) { | ||
Write-Host "::error::Minor version number must be even" | ||
exit 1 | ||
} | ||
|
||
if($isPreview) { | ||
if($minorVer -eq 0) { | ||
$newMinorVer = 999 | ||
$majorVer = $majorVer - 1 | ||
} else { | ||
$newMinorVer = $minorVer - 1 | ||
} | ||
|
||
$infix = $previewInfix | ||
} else { | ||
$newMinorVer = $minorVer | ||
$infix = "" | ||
} | ||
|
||
$nextPathVer = 0 | ||
|
||
do { | ||
$nextVersion = "$majorVer.$newMinorVer.$nextPathVer" | ||
$nextVersionTag = "$product$infix-v$nextVersion" | ||
git -C $env:GITHUB_WORKSPACE rev-parse "refs/tags/$nextVersionTag" --quiet 2> Out-Null | ||
if($?) { $nextPathVer = $nextPathVer + 1 } | ||
else { break } | ||
} while($true) | ||
|
||
"next-version=$nextVersion" >> $env:GITHUB_OUTPUT | ||
"next-version-tag=$nextVersionTag" >> $env:GITHUB_OUTPUT | ||
|
||
Write-Host "Next version: $nextVersion" | ||
Write-Host "Next version tag name: $nextVersionTag" | ||
|
||
exit 0 |
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 |
---|---|---|
|
@@ -35,7 +35,8 @@ jobs: | |
id: cody | ||
with: | ||
repository: sourcegraph/cody | ||
prefix: vscode- | ||
regex: 'vscode(-insiders)?-v\d+\.\d+\.\d+' | ||
sort-tags: true | ||
|
||
- name: Hash tag name | ||
uses: pplanel/[email protected] | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
name: Publish preview | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- preview-v*.*.* | ||
workflow_dispatch: | ||
inputs: | ||
publish: | ||
type: choice | ||
description: Publish type | ||
default: Preview | ||
options: | ||
- Preview | ||
- Release | ||
|
||
# concurrency prevents multiple instances of the workflow from running at the same time, | ||
# using `cancel-in-progress` to cancel any existing runs. | ||
|
@@ -29,12 +35,12 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Extract version from tag | ||
uses: nowsprinting/check-version-[email protected] | ||
|
||
- name: Generate version | ||
uses: ./.github/actions/next-version-gen | ||
id: version | ||
with: | ||
prefix: preview-v | ||
publish-type: ${{ github.event.inputs.publish }} | ||
|
||
- name: Add msbuild | ||
uses: microsoft/setup-msbuild@v2 | ||
|
@@ -61,13 +67,13 @@ jobs: | |
- name: Set version on AssemblyInfo.cs files | ||
uses: dannevesdantas/[email protected] | ||
with: | ||
version: ${{ steps.version.outputs.full_without_prefix }} | ||
version: ${{ steps.version.outputs.next-version }} | ||
path: src/ | ||
|
||
- name: Set version for .vsixmanifest file | ||
uses: cezarypiatek/[email protected] | ||
with: | ||
version: ${{ steps.version.outputs.full_without_prefix }} | ||
version: ${{ steps.version.outputs.next-version }} | ||
vsix-manifest-file: src\Cody.VisualStudio\source.extension.vsixmanifest | ||
|
||
- name: Build extension (${{ env.Configuration }}) | ||
|
@@ -106,30 +112,51 @@ jobs: | |
files: TestResults/**/*.trx | ||
|
||
#Publish | ||
- name: Create git tag | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "refs/tags/${{ steps.version.outputs.next-version-tag }}", | ||
sha: context.sha | ||
}) | ||
- name: Create GitHub release | ||
uses: ncipollo/[email protected] | ||
with: | ||
tag: ${{ steps.version.outputs.full }} | ||
name: Cody for Visual Studio ${{ steps.version.outputs.full_without_prefix }} | ||
tag: ${{ steps.version.outputs.next-version-tag }} | ||
name: Cody for Visual Studio ${{ steps.version.outputs.next-version }} | ||
prerelease: true | ||
artifacts: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix | ||
|
||
- name: Create custom VSIX feed | ||
if: ${{ github.event.inputs.publish == 'Preview' }} | ||
uses: ./.github/actions/create-vsix-feed | ||
with: | ||
vsix-directory: src/Cody.VisualStudio/bin/${{ env.Configuration }} | ||
feed-file: feed/feed.xml | ||
source-path: https://github.com/sourcegraph/cody-vs/releases/download/${{ steps.version.outputs.full }}/ | ||
source-path: https://github.com/sourcegraph/cody-vs/releases/download/${{ steps.version.outputs.next-version-tag }}/ | ||
gallery-name: "Sourcegraph preview gallery" | ||
|
||
- name: Upload feed files as artifact | ||
if: ${{ github.event.inputs.publish == 'Preview' }} | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
name: vsix-gallery-feed | ||
path: feed/ | ||
|
||
- name: Deploy feed to GitHub Pages | ||
if: ${{ github.event.inputs.publish == 'Preview' }} | ||
uses: actions/deploy-pages@v4 | ||
with: | ||
artifact_name: vsix-gallery-feed | ||
artifact_name: vsix-gallery-feed | ||
|
||
- name: Publish to Visual Studio Marketplace | ||
if: ${{ github.event.inputs.publish == 'Release' }} | ||
uses: cezarypiatek/[email protected] | ||
with: | ||
extension-file: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix | ||
publish-manifest-file: src\Cody.VisualStudio\publishManifest.json | ||
personal-access-code: ${{ secrets.CODY_VS_MARKETPLACE_RELEASE_TOKEN }} |
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