diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..f1cd88a --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,76 @@ +name: "Update Helm Chart Tag" + +on: + workflow_dispatch: + inputs: + new_version: + description: 'New version to update' + required: true + type: string + repository_dispatch: + types: [update-helm-chart-version] + +permissions: + actions: read + contents: write + pull-requests: write + +env: + CI_COMMIT_AUTHOR: bump-version-wf + CI_COMMIT_EMAIL: actions@github.com + HELM_BRANCH: master + HELM_BRANCH_MERGE: "feat(helm)/update-to-" + CHART_FILE: charts/kestra/Chart.yaml + +jobs: + update-helm-chart: + runs-on: ubuntu-latest + + steps: + - name: Set HELM_VERSION + id: set-helm-version + run: | + if [ -n "${{ github.event.client_payload.new_version }}" ]; then + echo "HELM_BRANCH_MERGE=${{ env.HELM_BRANCH_MERGE }}${{ github.event.client_payload.new_version }}" >> $GITHUB_ENV + echo "HELM_VERSION=${{ github.event.client_payload.new_version }}" >> $GITHUB_ENV + else + echo "HELM_BRANCH_MERGE=${{ env.HELM_BRANCH_MERGE }}${{ github.event.client_payload.new_version }} >> $GITHUB_ENV + echo "HELM_VERSION=${{ inputs.new_version }}" >> $GITHUB_ENV + fi + echo "version: ${HELM_VERSION#v}" + echo "appVersion: ${HELM_VERSION}" + echo "HELM_BRANCH_MERGE: ${HELM_BRANCH_MERGE}" + - name: Checkout master branch + uses: actions/checkout@v4 + with: + ref: ${{ env.HELM_BRANCH }} + + - name: Update Tag in YAML File + id: edit-chart-version + env: + HELM_VERSION: ${{ env.HELM_VERSION }} + run: | + git config user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config user.email "${{ env.CI_COMMIT_EMAIL }}" + # Update the appVersion with the new tag + yq e -i ".appVersion = \"${HELM_VERSION}\"" ${{ env.CHART_FILE }} + # Update the version with the new tag, removing the leading 'v' + yq e -i ".version = \"${HELM_VERSION#v}\"" ${{ env.CHART_FILE }} + git add ${{ env.CHART_FILE }} + git commit -m "Update version to ${HELM_VERSION#v} and appVersion to ${HELM_VERSION}" + + - name: Create Pull Request + id: create-pr + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_ACCESS_TOKEN }} + branch: ${{ env.HELM_BRANCH_MERGE }} + delete-branch: true + title: 'Helm chart update to ${HELM_VERSION#v}' + body: | + Helm Chart update to new version: + - In ${{ env.CHART_FILE }} new version is ${HELM_VERSION#v} + - In ${{ env.CHART_FILE }} new appVersion is ${HELM_VERSION} + - Auto-generated by "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Action URL>" + labels: | + automated pr \ No newline at end of file