Final Release 0.31 #216
Workflow file for this run
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
# ------------------------------------------------------------ | |
# 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. | |
# ------------------------------------------------------------ | |
name: Release Radius | |
on: | |
push: | |
branches: | |
- main | |
- 'release/*' | |
paths: | |
- 'versions.yaml' | |
pull_request: | |
branches: | |
- main | |
- 'release/*' | |
paths: | |
- 'versions.yaml' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
jobs: | |
generate_release_note: | |
name: Generate release note from template | |
runs-on: ubuntu-latest | |
# We should only create the release note if this is a pull request against main | |
if: github.repository == 'radius-project/radius' && github.event_name == 'pull_request' && github.base_ref == 'main' | |
env: | |
RELNOTE_FOUND: false | |
steps: | |
- name: Checkout radius-project/radius | |
uses: actions/checkout@v3 | |
- name: Get supported versions from versions.yaml | |
id: get-supported-versions | |
uses: mikefarah/[email protected] | |
with: | |
# Get a comma-separated list of supported versions | |
cmd: yq '.supported[].version' versions.yaml | tr '\n' ',' | sed 's/,$//' | |
- name: Determine desired release version | |
id: get-version | |
run: | | |
./.github/scripts/release-get-version.sh ${{ steps.get-supported-versions.outputs.result }} "." | |
- name: Find the previous tag | |
uses: actions/github-script@v6 | |
id: latest-release-tag | |
with: | |
github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
result-encoding: string | |
script: | | |
const { data } = await github.rest.repos.getLatestRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
return data.tag_name | |
- name: Generate the release notes | |
uses: actions/github-script@v6 | |
id: generate-notes | |
with: | |
github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
result-encoding: string | |
script: | | |
const { data } = await github.rest.repos.generateReleaseNotes({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: '${{ steps.get-version.outputs.release-version }}', | |
target_commitish: 'main', | |
previous_tag_name: '${{ steps.latest-release-tag.outputs.result }}', | |
}) | |
return data.body | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: relnote-${{ github.run_id }} | |
number: ${{ github.event.pull_request.number }} | |
hide: true | |
hide_classify: 'OUTDATED' | |
message: | | |
## Release Information | |
* Previous version: ${{ steps.latest-release-tag.outputs.result }} | |
* New version: ${{ steps.get-version.outputs.release-version }} | |
## Change logs | |
``` | |
${{ steps.generate-notes.outputs.result }} | |
``` | |
- name: Find release note | |
shell: bash | |
run: | | |
if [ -f ./docs/release-notes/${{ steps.get-version.outputs.release-version }}.md ]; then | |
echo "RELNOTE_FOUND=true" >> $GITHUB_ENV | |
fi | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
continue-on-error: true | |
if: ${{ !contains(steps.get-version.outputs.release-version, '-rc') && env.RELNOTE_FOUND == 'false' }} | |
with: | |
header: relnote-${{ github.run_id }} | |
number: ${{ github.event.pull_request.number }} | |
append: true | |
message: | | |
## :warning: Missing release note :warning: | |
This is the official Radius release. Create the release note by following instruction: | |
1. Create ./docs/release-notes/${{ steps.get-version.outputs.release-version }}.md from [release note template](https://github.com/radius-project/radius/blob/main/docs/release-notes/template.md) | |
2. Update the each section and add the above Change logs to the end of release note. | |
3. Push release note changes to the PR branch. | |
- name: Stop the workflow if release is the official and its release note is not found. | |
if: ${{ !contains(steps.get-version.outputs.release-version, '-rc') && env.RELNOTE_FOUND == 'false' }} | |
run: exit 1 | |
release: | |
name: Create a new Radius release | |
if: github.repository == 'radius-project/radius' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout radius-project/radius@main | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/radius | |
ref: main | |
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
path: radius | |
- name: Checkout radius-project/bicep@bicep-extensibility | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/bicep | |
ref: bicep-extensibility | |
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
path: bicep | |
- name: Checkout radius-project/deployment-engine@main | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/deployment-engine | |
ref: main | |
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
path: deployment-engine | |
- name: Checkout radius-project/recipes@main | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/recipes | |
ref: main | |
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
path: recipes | |
- name: Checkout radius-project/dashboard@main | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/dashboard | |
ref: main | |
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
path: dashboard | |
- name: Set up GitHub credentials | |
run: | | |
git config --global user.name "Radius CI Bot" | |
git config --global user.email "[email protected]" | |
- name: Get supported versions from versions.yaml | |
id: get-supported-versions | |
uses: mikefarah/[email protected] | |
with: | |
# Get a comma-separated list of supported versions | |
cmd: yq '.supported[].version' ./radius/versions.yaml | tr '\n' ',' | sed 's/,$//' | |
- name: Determine desired release version | |
id: get-version | |
run: | | |
./radius/.github/scripts/release-get-version.sh ${{ steps.get-supported-versions.outputs.result }} radius | |
- name: Check if release branch exists | |
id: release-branch-exists | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
script: | | |
try { | |
const { data } = await github.rest.repos.getBranch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
branch: '${{ steps.get-version.outputs.release-branch-name }}', | |
}) | |
if (data && data.name == '${{ steps.get-version.outputs.release-branch-name }}' && context.ref == 'refs/heads/main' && context.eventName == 'push') { | |
console.log("Release branch ${{ steps.get-version.outputs.release-branch-name }} already exists and this is a push to main.") | |
return 'true' | |
} else { | |
console.log("This is not a push to main.") | |
return 'false' | |
} | |
} catch (error) { | |
console.log("Release branch ${{ steps.get-version.outputs.release-branch-name }} does not exist.") | |
return 'false' | |
} | |
- name: Generate release summary | |
if: steps.release-branch-exists.outputs.result == 'false' | |
run: | | |
echo "## Release" >> $GITHUB_STEP_SUMMARY | |
echo "* Release driver: $GITHUB_ACTOR ">> $GITHUB_STEP_SUMMARY | |
echo "* Supported versions: ${{ steps.get-supported-versions.outputs.result }}" >> $GITHUB_STEP_SUMMARY | |
echo "* Desired release tag: ${{ steps.get-version.outputs.release-version }}" >> $GITHUB_STEP_SUMMARY | |
echo "* Desired release branch: ${{ steps.get-version.outputs.release-branch-name }}" >> $GITHUB_STEP_SUMMARY | |
echo "* Release date: $(date)" >> $GITHUB_STEP_SUMMARY | |
- name: Release radius-project/radius version ${{ steps.get-version.outputs.release-version }} | |
if: success() && steps.release-branch-exists.outputs.result == 'false' | |
run: | | |
./radius/.github/scripts/release-create-tag-and-branch.sh radius ${{ steps.get-version.outputs.release-version }} ${{ steps.get-version.outputs.release-branch-name }} | |
- name: Release radius-project/bicep version ${{ steps.get-version.outputs.release-version }} | |
if: success() && steps.release-branch-exists.outputs.result == 'false' | |
run: | | |
./radius/.github/scripts/release-create-tag-and-branch.sh bicep ${{ steps.get-version.outputs.release-version }} ${{ steps.get-version.outputs.release-branch-name }} | |
- name: Release radius-project/deployment-engine version ${{ steps.get-version.outputs.release-version }} | |
if: success() && steps.release-branch-exists.outputs.result == 'false' | |
run: | | |
./radius/.github/scripts/release-create-tag-and-branch.sh deployment-engine ${{ steps.get-version.outputs.release-version }} ${{ steps.get-version.outputs.release-branch-name }} | |
- name: Release radius-project/recipes version ${{ steps.get-version.outputs.release-version }} | |
if: success() && steps.release-branch-exists.outputs.result == 'false' | |
run: | | |
./radius/.github/scripts/release-create-tag-and-branch.sh recipes ${{ steps.get-version.outputs.release-version }} ${{ steps.get-version.outputs.release-branch-name }} | |
- name: Release radius-project/dashboard version ${{ steps.get-version.outputs.release-version }} | |
if: success() && steps.release-branch-exists.outputs.result == 'false' | |
run: | | |
./radius/.github/scripts/release-create-tag-and-branch.sh dashboard ${{ steps.get-version.outputs.release-version }} ${{ steps.get-version.outputs.release-branch-name }} |