-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding release automation to main branch
- Loading branch information
1 parent
deda94b
commit 375d306
Showing
1 changed file
with
49 additions
and
0 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,49 @@ | ||
name: Release samples | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1)' | ||
required: true | ||
default: '' | ||
type: string | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT }} | ||
GITHUB_EMAIL: '[email protected]' | ||
GITHUB_USER: 'Radius CI Bot' | ||
|
||
jobs: | ||
release-samples: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | ||
ref: edge | ||
path: samples | ||
- name: Configure git | ||
run: | | ||
git config --global user.email "${{ env.GITHUB_EMAIL }}" | ||
git config --global user.name "${{ env.GITHUB_USER }}" | ||
- name: Ensure inputs.version is valid semver | ||
run: | | ||
python ./samples/.github/scripts/validate_semver.py ${{ inputs.version }} | ||
- name: Parse release channel | ||
id: parse_release_channel | ||
run: | | ||
# CHANNEL is the major and minor version of the VERSION_NUMBER (e.g. 0.1) | ||
CHANNEL="$(echo ${{ inputs.version }} | cut -d '.' -f 1,2)" | ||
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT | ||
- name: Release samples | ||
run: | | ||
./samples/.github/scripts/release-samples.sh ${{ inputs.version }} | ||
- name: Change the default branch | ||
run: | | ||
gh api \ | ||
--method PATCH \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/radius-project/samples \ | ||
-f default_branch='v${{ steps.parse_release_channel.outputs.channel }}' |