Bump tanzu-plugin-runtime to v1.4.0 (#792) #75
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
name: Release | |
on: | |
push: | |
branches: | |
- "!not_activated_on_branches!*" | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-*" | |
jobs: | |
build: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free some disk space on runner | |
run: | | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf /usr/lib/jvm | |
sudo rm -rf /usr/lib/firefox | |
sudo rm -rf /opt/microsoft/powershell | |
sudo rm -rf /opt/hostedtoolcache | |
echo "free space after cleanup:" | |
df -h | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v1 | |
- name: Generate details for creating release notes | |
id: generate-release-details | |
shell: bash | |
run: | | |
set -o xtrace | |
RELEASE_BRANCH="main" | |
RELEASE_VERSION=${GITHUB_REF#refs/*/} | |
major=$(echo "$RELEASE_VERSION" | sed 's/^v\(.*\)/\1/' | cut -d. -f1) | |
minor=$(echo "$RELEASE_VERSION" | cut -d. -f2) | |
revision=$(echo "$RELEASE_VERSION" | cut -d. -f3 | cut -d- -f1) | |
if [ "$revision" -gt 0 ];then | |
revision=$(($revision-1)) | |
RELEASE_BRANCH="release-${major}.${minor}" | |
LAST_TAG="v${major}.${minor}.${revision}" | |
elif [ "$minor" -gt 0 ]; then | |
minor=$(($minor-1)) | |
LAST_TAG=$(git tag | grep -E "^v${major}\.${minor}\.[0-9]+$" | tail -1) | |
elif [ "$major" -gt 0 ]; then | |
major=$(($major-1)) | |
LAST_TAG=$(git tag | grep -E "^v${major}\.[0-9]+\.[0-9]+$" | tail -1) | |
else | |
echo "Please validate that the tag release version(${RELEASE_VERSION}) conforms to semver." | |
exit 1 | |
fi | |
git log -3 --format=oneline | |
echo "Last release tag - $LAST_TAG" | |
START_SHA=$(git rev-list -n 1 $LAST_TAG) | |
echo "Release note generator start SHA - $START_SHA" | |
END_SHA=$(git rev-list -n 1 $RELEASE_VERSION) | |
echo "Release note generator end SHA - $END_SHA" | |
echo "::set-output name=start-sha::$START_SHA" | |
echo "::set-output name=end-sha::$END_SHA" | |
echo "::set-output name=release-version::$RELEASE_VERSION" | |
echo "::set-output name=prev-release-version::$LAST_TAG" | |
echo "::set-output name=repo-name::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" | |
echo "::set-output name=repo-org::$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" | |
echo "::set-output name=release-branch::$RELEASE_BRANCH" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install release-note dependency | |
run: | | |
go install k8s.io/release/cmd/[email protected] | |
- name: Get Time | |
id: time | |
uses: nanzm/[email protected] | |
with: | |
format: 'YYYYMMDDHHmmss' | |
- name: Generate release notes | |
id: get-release-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
release-notes \ | |
--github-base-url https://github.com \ | |
--org ${{ steps.generate-release-details.outputs.repo-org }} \ | |
--repo ${{ steps.generate-release-details.outputs.repo-name }} \ | |
--branch ${{ steps.generate-release-details.outputs.release-branch }} \ | |
--required-author "" \ | |
--start-sha ${{ steps.generate-release-details.outputs.start-sha }} \ | |
--end-sha ${{ steps.generate-release-details.outputs.end-sha }} \ | |
--output /tmp/${{ steps.time.outputs.time }}-bin-notes | |
- name: Get Github Release notes | |
uses: octokit/[email protected] | |
id: get-github-release-notes | |
with: | |
route: POST /repos/{owner}/{repo}/releases/generate-notes | |
owner: ${{ steps.generate-release-details.outputs.repo-org }} | |
repo: ${{ steps.generate-release-details.outputs.repo-name }} | |
tag_name: ${{ steps.generate-release-details.outputs.release-version }} | |
previous_tag_name: ${{ steps.generate-release-details.outputs.prev-release-version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Identify New Contributors Section' | |
id: get-new-contributors | |
env: | |
body: "${{ fromJson(steps.get-github-release-notes.outputs.data).body }}" | |
run: | | |
githubOutput="/tmp/${{ steps.time.outputs.time }}-github-output" | |
echo "$body" > "$githubOutput" | |
- name: Generate the release notes | |
shell: bash | |
run: | | |
NEW_CONTRIBUTORS=$(sed -n '/## New Contributors/,$p' /tmp/${{ steps.time.outputs.time }}-github-output) | |
RELEASE_TOOL_NOTES=$(sed 's/### Uncategorized/### Miscellaneous/g' /tmp/${{ steps.time.outputs.time }}-bin-notes) | |
RELEASE_NOTES=$(cat <<-END | |
## Tanzu CLI Installation Instructions | |
If you are installing Tanzu CLI using the artifacts published as part of this release, please follow the | |
[instructions](https://github.com/vmware-tanzu/tanzu-cli/blob/main/docs/quickstart/install.md#from-the-binary-releases-in-github-project). | |
$RELEASE_TOOL_NOTES | |
$NEW_CONTRIBUTORS | |
END | |
) | |
echo "$RELEASE_NOTES" | |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
echo "$RELEASE_NOTES" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- id: create_draft_release | |
name: Create Draft Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
body: ${{ env.RELEASE_NOTES }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |