|
| 1 | +on: |
| 2 | + workflow_dispatch: |
| 3 | + inputs: |
| 4 | + tag: |
| 5 | + description: 'The release tag of Timeplus Enterprise (e.g. v2.8.1)' |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + pre_release: |
| 9 | + description: 'Whether this is a pre release. If it is checked, the PR to update helm chart on install.timeplus.com repo will be SKIPPED' |
| 10 | + required: false |
| 11 | + type: boolean |
| 12 | + |
| 13 | +name: Bump Timeplus Enterprise version |
| 14 | +jobs: |
| 15 | + bump: |
| 16 | + name: Bump Timeplus Enterprise version |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + repository-projects: write |
| 22 | + steps: |
| 23 | + - name: Process variables |
| 24 | + id: var |
| 25 | + shell: bash |
| 26 | + run: | |
| 27 | + major=$(echo "${{ inputs.tag }}" | cut -d '.' -f 1) |
| 28 | + minor=$(echo "${{ inputs.tag }}" | cut -d '.' -f 2) |
| 29 | + if [ "$major" == "v3" ]; then |
| 30 | + # TPE v3.0 -> Helm v10.0 |
| 31 | + ((chart_major=$minor+10)) |
| 32 | + else |
| 33 | + echo "This major version ${major} is not supported " |
| 34 | + exit 1 |
| 35 | + fi |
| 36 | +
|
| 37 | + chart_branch="release/v$chart_major.0" |
| 38 | + echo "Using branch $chart_branch for TPE ${{ inputs.tag }}" |
| 39 | + echo "chart_branch=${chart_branch}" >> $GITHUB_OUTPUT |
| 40 | + echo "chart_major=${chart_major}" >> $GITHUB_OUTPUT |
| 41 | +
|
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + ref: ${{ steps.var.outputs.chart_branch }} |
| 46 | + token: ${{ secrets.GH_ACCESS_TOKEN }} |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Checkout TPE |
| 50 | + uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + path: timeplus-enterprise |
| 53 | + repository: timeplus-io/timeplus-enterprise |
| 54 | + ref: refs/tags/${{ inputs.tag }} |
| 55 | + token: ${{ secrets.GH_ACCESS_TOKEN }} |
| 56 | + |
| 57 | + - name: Install tools |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + pushd /tmp |
| 61 | + wget https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz |
| 62 | + tar -xvf helm-docs_1.14.2_Linux_x86_64.tar.gz |
| 63 | + sudo mv helm-docs /usr/local/sbin |
| 64 | + popd |
| 65 | +
|
| 66 | + - name: Update chart |
| 67 | + id: update |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + VERSION_FILE="./timeplus-enterprise/.env" |
| 71 | + cat "$VERSION_FILE" |
| 72 | +
|
| 73 | + while IFS='=' read -r component version; do |
| 74 | + if [[ -n "$component" && -n "$version" ]]; then |
| 75 | + if [ "${component}" = "ORBIT_VERSION" ]; then |
| 76 | + LINE=$(yq '.timeplusConnector.tag | line' ./charts/timeplus-enterprise/values.yaml) |
| 77 | + sed -i "${LINE}s/.*/ tag: $version/" "./charts/timeplus-enterprise/values.yaml" |
| 78 | + elif [ "${component}" = "NEUTRON_VERSION" ]; then |
| 79 | + LINE=$(yq '.timeplusAppserver.tag | line' ./charts/timeplus-enterprise/values.yaml) |
| 80 | + sed -i "${LINE}s/.*/ tag: $version/" "./charts/timeplus-enterprise/values.yaml" |
| 81 | + elif [ "${component}" = "PROTON_VERSION" ]; then |
| 82 | + LINE=$(yq '.timeplusd.tag | line' ./charts/timeplus-enterprise/values.yaml) |
| 83 | + sed -i "${LINE}s/.*/ tag: $version/" "./charts/timeplus-enterprise/values.yaml" |
| 84 | + elif [ "${component}" = "TIMEPLUS_CLI_VERSION" ]; then |
| 85 | + LINE=$(yq '.timeplusCli.tag | line' ./charts/timeplus-enterprise/values.yaml) |
| 86 | + sed -i "${LINE}s/.*/ tag: $version/" "./charts/timeplus-enterprise/values.yaml" |
| 87 | + elif [ "${component}" = "VERSION" ]; then |
| 88 | + sed -i "9s/.*/appVersion: $version/" "./charts/timeplus-enterprise/Chart.yaml" |
| 89 | + echo "app_version=v$(echo $version)" >> $GITHUB_OUTPUT |
| 90 | + fi |
| 91 | + fi |
| 92 | + done < "$VERSION_FILE" |
| 93 | + rm -rf ./timeplus-enterprise |
| 94 | + make docs |
| 95 | + git status |
| 96 | +
|
| 97 | + # remote: Write access to repository not granted. |
| 98 | + # is reported when using `GH_ACCESS_TOKEN` |
| 99 | + - uses: stefanzweifel/git-auto-commit-action@v5 |
| 100 | + with: |
| 101 | + commit_message: 'feat(timeplus-enterprise): app ${{ steps.update.outputs.app_version}}' |
| 102 | + |
| 103 | + - name: Find version |
| 104 | + id: version |
| 105 | + run: | |
| 106 | + echo "Timeplus Enterprise Release: https://github.com/timeplus-io/timeplus-enterprise/releases/tag/${{ inputs.tag }}" > release_note.txt |
| 107 | + make versions >> release_note.txt |
| 108 | +
|
| 109 | + next_version=$(echo $(git describe --tags) | awk -F. -v OFS=. '{$NF += 1 ; print}') |
| 110 | + echo "next_version=${next_version}" >> $GITHUB_OUTPUT |
| 111 | +
|
| 112 | + - name: Create release |
| 113 | + uses: softprops/action-gh-release@v2 |
| 114 | + with: |
| 115 | + target_commitish: ${{ steps.var.outputs.chart_branch }} |
| 116 | + tag_name: ${{ steps.version.outputs.next_version }} |
| 117 | + name: ${{ steps.version.outputs.next_version }} |
| 118 | + token: ${{ secrets.GH_ACCESS_TOKEN }} |
| 119 | + body_path: release_note.txt |
| 120 | + prerelease: ${{ inputs.pre_release }} |
0 commit comments