name: Update Version on: push: branches: - main jobs: version: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} - name: Get previous version id: previous_version run: | VERSION=$(grep "buster=" version.txt | cut -d'=' -f2) echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Conventional Commit Check and Version Bump id: version_bump uses: mathieudutour/github-tag-action@v6.1 with: github_token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} default_bump: false dry_run: true tag_prefix: "" - name: Update version.txt if: steps.version_bump.outputs.new_version != steps.previous_version.outputs.version run: | NEW_VERSION="${{ steps.version_bump.outputs.new_version }}" sed -i "s/buster=.*/buster=$NEW_VERSION/" version.txt - name: Commit and push if changed if: steps.version_bump.outputs.new_version != steps.previous_version.outputs.version run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add version.txt git commit -m "chore: bump version to ${{ steps.version_bump.outputs.new_version }}" git push