buklo 0.1.12

Buklo is a simple CLI HTTP client
name: "Push tagged release"
on:
  push:
    branches: ['main', 'release-*']

jobs:
  push_tag:
    if: github.repository == 'ghishadow/buklo'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true
          fetch-depth: 0
      - name: Test if tag is needed
        run: |
          git log ${{ github.event.before }}...${{ github.event.after }} | tee main.log
          version=$(grep 'version =' Cargo.toml | head -n 1 | sed 's/.*"\(.*\)"/\1/')
          echo "version: $version"
          echo "::set-output name=version::$version"
          echo "::set-output name=sha::$(git rev-parse HEAD)"
          if grep -q "automatically-tag-and-release-this-commit" main.log; then
            echo push-tag
            echo "::set-output name=push_tag::yes"
          else
            echo no-push-tag
            echo "::set-output name=push_tag::no"
          fi
        id: tag
      - name: Push the tag
        run: |
          git_refs_url=$(jq .repository.git_refs_url $GITHUB_EVENT_PATH | tr -d '"' | sed 's/{\/sha}//g')
          curl -iX POST $git_refs_url \
            -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
            -d @- << EOF
          {
            "ref": "refs/tags/v${{ steps.tag.outputs.version }}",
            "sha": "${{ steps.tag.outputs.sha }}"
          }
          EOF
        if: steps.tag.outputs.push_tag == 'yes'