Scaffold out the release process for this PR (#56) #9
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
name: Release | |
run-name: Starting release for ${{ inputs.package }} | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
description: Which package to release | |
required: true | |
type: choice | |
options: | |
- Bitwarden.Server.Sdk | |
permissions: | |
pull-requests: write | |
contents: write | |
env: | |
PACKAGE_DIRECTORY: './extensions/${{ inputs.package }}' | |
jobs: | |
start-release: | |
name: Create release candidate | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up .NET | |
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0 | |
# get current version | |
- name: Get current version | |
id: current-version | |
run: echo "VERSION=$(dotnet msbuild --getProperty:Version)" >> $GITHUB_OUTPUT | |
working-directory: '${{ env.PACKAGE_DIRECTORY }}/src' | |
- name: Create release candidate branch | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const packageName = '${{ inputs.package }}'; | |
const currentVersion = '${{ steps.current-version.outputs.VERSION }}'; | |
// Configure Git | |
await exec.exec(`git config user.name "github-actions"`); | |
await exec.exec(`git config user.email "[email protected]"`); | |
var versionParts = currentVersion.split('.'); | |
if (versionParts.length <= 2) { | |
core.setFailed(`Invalid current version: ${currentVersion}`); | |
return; | |
} | |
const releaseCandidateBranch = `release/${packageName}/${versionParts[0]}.${versionParts[1]}`; | |
await exec.exec(`git checkout -b ${releaseCandidateBranch}`); | |
await exec.exec(`git push --set-upstream origin HEAD:${releaseCandidateBranch}`); | |
- name: Bump version | |
uses: bitwarden/dotnet-extensions/.github/workflows/version-bump.yml@main | |
with: | |
type: ga | |
package: ${{ inputs.package }} |