-
Notifications
You must be signed in to change notification settings - Fork 35
Add samples release automation #499
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
34a9fac
Adding samples release automation
willdavsmith 7d3a3fe
bug
willdavsmith fc37fef
nit
willdavsmith be8122f
nit
willdavsmith 662ffc3
nit
willdavsmith bcc02dc
PR
willdavsmith c56065c
PR
willdavsmith b1e177f
PR
willdavsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,42 @@ | ||
| # ------------------------------------------------------------ | ||
| # Copyright 2023 The Radius Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ------------------------------------------------------------ | ||
|
|
||
| set -xe | ||
|
|
||
| VERSION_NUMBER=$1 # (e.g. 0.1.0) | ||
| REPOSITORY="samples" | ||
|
|
||
| if [[ -z "$VERSION_NUMBER" ]]; then | ||
| echo "Error: VERSION_NUMBER is not set." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # CHANNEL is the major and minor version of the VERSION_NUMBER (e.g. 0.1) | ||
| CHANNEL="$(echo $VERSION_NUMBER | cut -d '.' -f 1,2)" | ||
|
|
||
| # CHANNEL_VERSION is the version with the 'v' prefix (e.g. v0.1) | ||
| CHANNEL_VERSION="v${CHANNEL}" | ||
|
|
||
| echo "Version number: ${VERSION_NUMBER}" | ||
| echo "Channel: ${CHANNEL}" | ||
| echo "Channel version: ${CHANNEL_VERSION}" | ||
|
|
||
| echo "Creating release branch for ${REPOSITORY}..." | ||
|
|
||
| pushd $REPOSITORY | ||
| git checkout -B "${CHANNEL_VERSION}" | ||
| git push origin "${CHANNEL_VERSION}" | ||
| popd |
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,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: 'radiuscoreteam@service.microsoft.com' | ||
| 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/project-radius/samples \ | ||
| -f default_branch='v${{ steps.parse_release_channel.outputs.channel }}' | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably need a different token. Not sure if the default actions token can change the default branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added to GITHUB_ENV