Merge pull request #3544 from cyclinder/bump_version_0.9.4 #104
Workflow file for this run
name: Auto Version Release | ||
# it is trigger by tag event: | ||
# 1 build the release image, push images to ghcr.io, and build image like: ghcr.io/weizhoublue/github-action-test/controllerimage:v1.0.0 | ||
# 2 package the chart package, update index.yaml and commit to '/charts' of branch 'github_pages' ( PR with label pr/release/robot_update_githubpage ) | ||
# 3 create changelog file, commit to '/changelogs' of branch 'github_pages' for githubPage ( PR with label pr/release/robot_update_githubpage ) | ||
# 4 commit '/docs' to '/docs' of branch 'github_pages' | ||
# 5 create a release , attached with the chart and changelog | ||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Tag' | ||
required: true | ||
default: v1.0.0 | ||
permissions: write-all | ||
jobs: | ||
get-tag: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ env.RUN_TAG }} | ||
steps: | ||
- name: Get Ref | ||
id: get_ref | ||
run: | | ||
if ${{ github.event_name == 'workflow_dispatch' }} ; then | ||
echo "call by self workflow_dispatch" | ||
echo "RUN_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | ||
YBranchName=` grep -Eo "v[0-9]+\.[0-9]+" <<< "${{ github.event.inputs.tag }}" ` | ||
elif ${{ github.event_name == 'push' }} ; then | ||
echo "call by push tag" | ||
echo "RUN_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
YBranchName=` grep -Eo "v[0-9]+\.[0-9]+" <<< "${GITHUB_REF##*/}" ` | ||
else | ||
echo "unexpected event: ${{ github.event_name }}" | ||
exit 1 | ||
fi | ||
echo "YBranchName=${YBranchName}" | ||
if [ -n "$YBranchName" ] ; then | ||
echo "RUN_YBranchName=${YBranchName}" >> $GITHUB_ENV | ||
else | ||
echo "error, failed to find y branch" | ||
exit 1 | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.RUN_TAG }} | ||
- name: Check Version | ||
run: | | ||
TagVersion="${{ env.RUN_TAG }}" | ||
RecordVersion=` cat VERSION | tr -d ' ' | tr -d '\n' ` | ||
if [ "$RecordVersion" != "$TagVersion" ] ; then | ||
echo "error, version $RecordVersion of '/VERSION' is different with Tag $TagVersion " | ||
exit 1 | ||
fi | ||
#no need to check chart version, which will auto update to /VERSION by CI | ||
# if branch exists, the action will no fail, and it output created=false | ||
- name: release Y branch | ||
uses: peterjgrainger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: 'release-${{ env.RUN_YBranchName }}' | ||
sha: '${{ github.sha }}' | ||
# for auto-cherrypick.yaml, create a label | ||
- name: Create cherry-pick label | ||
continue-on-error: true | ||
run: | | ||
echo ${{ secrets.WELAN_PAT }} | gh auth login --with-token | ||
branchLabelName="${{ env.LABEL_PREFIX_CHERRYPICK }}release-${{ env.RUN_YBranchName }}" | ||
mainLabelName="${{ env.LABEL_PREFIX_CHERRYPICK }}main" | ||
echo "try to create label " | ||
gh label create ${branchLabelName} --force | ||
(( $? !=0 )) && echo "error, failed to create label ${branchLabelName}" | ||
gh label create ${mainLabelName} --force | ||
(( $? !=0 )) && echo "error, failed to create label ${mainLabelName}" | ||
build-release-image: | ||
needs: get-tag | ||
uses: ./.github/workflows/call-release-image.yaml | ||
with: | ||
ref: ${{ needs.get-tag.outputs.tag }} | ||
secrets: inherit | ||
release-chart: | ||
needs: [build-release-image, get-tag] | ||
uses: ./.github/workflows/call-release-chart.yaml | ||
with: | ||
ref: ${{ needs.get-tag.outputs.tag }} | ||
submit: true | ||
secrets: inherit | ||
release-doc: | ||
needs: [build-release-image, get-tag] | ||
uses: ./.github/workflows/call-release-doc.yaml | ||
with: | ||
ref: ${{ needs.get-tag.outputs.tag }} | ||
secrets: inherit | ||
release-changelog: | ||
needs: [build-release-image, get-tag] | ||
uses: ./.github/workflows/call-release-changelog.yaml | ||
with: | ||
dest_tag: ${{ needs.get-tag.outputs.tag }} | ||
secrets: inherit | ||
update-release-version: | ||
needs: [build-release-image, get-tag] | ||
uses: ./.github/workflows/call-release-version.yaml | ||
Check failure on line 122 in .github/workflows/auto-version-release.yaml GitHub Actions / Auto Version ReleaseInvalid workflow file
Check failure on line 122 in .github/workflows/auto-version-release.yaml GitHub Actions / Auto Version ReleaseInvalid workflow file
Check failure on line 122 in .github/workflows/auto-version-release.yaml GitHub Actions / Auto Version ReleaseInvalid workflow file
Check failure on line 122 in .github/workflows/auto-version-release.yaml GitHub Actions / Auto Version ReleaseInvalid workflow file
Check failure on line 122 in .github/workflows/auto-version-release.yaml GitHub Actions / Auto Version ReleaseInvalid workflow file
Check failure on line 122 in .github/workflows/auto-version-release.yaml GitHub Actions / Auto Version ReleaseInvalid workflow file
|
||
with: | ||
dest_tag: ${{ needs.get-tag.outputs.tag }} | ||
secrets: inherit | ||
create-release: | ||
needs: [release-chart, release-changelog, get-tag] | ||
name: create release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Chart Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.release-chart.outputs.artifact }} | ||
path: chart-package/ | ||
- name: Download Changelog Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.release-changelog.outputs.artifact }} | ||
path: changelog-result/ | ||
- name: Get Downloaded Files | ||
id: download_file | ||
run: | | ||
# ========= chart | ||
if ! ls chart-package/*.tgz &>/dev/null ; then | ||
echo "error, failed to find any chart " | ||
exit 1 | ||
fi | ||
chart_path=$( ls chart-package/*.tgz ) | ||
echo "chart_path=${chart_path}" >> $GITHUB_ENV | ||
# ========== changelog | ||
if ! ls changelog-result/*.md &>/dev/null ; then | ||
echo "error, failed to find changelog " | ||
exit 2 | ||
fi | ||
ls changelog-result/ | ||
cat changelog-result/*.md | ||
changelog_file=$( ls changelog-result/ ) | ||
changelog_path=./changelog-result/${changelog_file} | ||
echo "changelog_path=${changelog_path}" >> $GITHUB_ENV | ||
cp ./changelog-result/${changelog_file} ./changelog-result/changelog.md | ||
- name: Create Release | ||
id: create_release | ||
continue-on-error: false | ||
uses: ncipollo/[email protected] | ||
with: | ||
artifacts: "chart-package/*" | ||
allowUpdates: true | ||
removeArtifacts: true | ||
replacesArtifacts: true | ||
artifactErrorsFailBuild: true | ||
bodyFile: "./changelog-result/changelog.md" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ needs.get-tag.outputs.tag }} | ||
name: "Release ${{ needs.get-tag.outputs.tag }}" |