diff --git a/.github/workflows/prashan_version_bump.yml b/.github/workflows/prashan_version_bump.yml new file mode 100644 index 000000000..175457dff --- /dev/null +++ b/.github/workflows/prashan_version_bump.yml @@ -0,0 +1,55 @@ +name: prashan testing new action +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: write + +jobs: + update_version: + runs-on: macos-latest + steps: + - name: checkout + uses: actions/checkout@v4 + with: + # Fetch full depth, otherwise the last step overwrites the last commit's parent, essentially removing the graph. + fetch-depth: 0 + token: ${{ secrets.BOT_PAT }} + ref: ${{ github.head_ref }} + + - name: Run bump_version_gh_action.sh + id: bump-version + run: | + set +e + ./bump_version_gh_action.sh + echo "bump_version_ret=$?" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.BOT_PAT }} + + - name: Import bot's GPG key for signing commits + id: import-gpg + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} + #git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true + + - name: Sign commit and push changes + run: | + if [[ "${{ steps.bump-version.outputs.bump_version_ret }}" == "0" ]]; then + git config --global user.email ${{ steps.import-gpg.outputs.name }} + git config --global user.name ${{ steps.import-gpg.outputs.email }} + + git commit -S -m "Bump version" build.gradle.kts + git push + fi + env: + # GITHUB_TOKEN: ${{ secrets.BOT_PAT }} + GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} + GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }} + GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }} + GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }} + diff --git a/bump_version_gh_action.sh b/bump_version_gh_action.sh index eaec58923..f2ca419c8 100755 --- a/bump_version_gh_action.sh +++ b/bump_version_gh_action.sh @@ -1,6 +1,6 @@ #!/bin/sh -printenv +echo vercomp () { if [[ $1 == $2 ]]