diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 97fbdf6..0eec480 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -80,7 +80,7 @@ jobs: destination_dir: ./repo bump: - needs: [release, maven] + needs: [release] runs-on: ubuntu-latest permissions: @@ -91,23 +91,35 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Setup Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - + - name: Bump id: bump_version run: | IFS='.' read -r MAJOR MINOR PATCH <<< "${{ needs.release.outputs.modversion }}" PATCH=$((PATCH + 1)) NEW_VERSION="$MAJOR.$MINOR.$PATCH" - echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "newversion=$NEW_VERSION" >> $GITHUB_OUTPUT sed -i "s/^mod_version=.*/mod_version=$NEW_VERSION/" gradle.properties + + - name: Get bot token + uses: actions/create-github-app-token@v2 + id: app_token + with: + app-id: ${{ secrets.CI_BOT_APP_ID }} + private-key: ${{ secrets.CI_BOT_PRIVATE_KEY }} - - name: Commit + - name: Setup Git + run: | + git config user.name "poopskymod-ci-bot[bot]" + git config user.email "poopskymod-ci-bot[bot]@users.noreply.github.com" + + - name: Set git remote to use App token + env: + BOT_TOKEN: ${{ steps.app_token.outputs.token }} run: | git add gradle.properties - git commit -m "Bump version to ${{ steps.bump_version.outputs.new }}" - git push + git commit -m "chore: bump to next version ${{ steps.bump_version.outputs.newversion }}" + git remote set-url origin https://x-access-token:${BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + + - name: Push with App token + run: git push origin ${{ github.ref_name }} --force