Skip to content
go-libfossil Artifact [618de742ab]
Login

Artifact [618de742ab]

Artifact 618de742abc473bc2a4dc54327d668931c94ece6204fc92cbbdc97b44955e6aa:


name: Release
on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # The go-libfossil rename left temporary `replace` directives bridging the
      # in-repo modules to local paths. A tag carrying them breaks
      # `go install github.com/danmestas/go-libfossil/cmd/libfossil@<tag>` and any
      # `@version` fetch of the driver submodules, because Go refuses a main module
      # that contains replace directives. Unblock a release by cutting new tags for
      # the submodules with the corrected module paths, bumping the root module's
      # requires to those versions, then deleting the replace blocks (and the stale
      # old-path lines they leave behind in the go.sum files).
      - name: Guard against replace directives
        run: |
          offenders=$(git ls-files '*go.mod' | xargs -r grep -l '^replace' || true)
          if [ -n "$offenders" ]; then
            echo "::error::refusing to release: go.mod replace directives present in:"
            echo "$offenders"
            exit 1
          fi

      - name: Create GitHub release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release create "${{ github.ref_name }}" \
            --generate-notes \
            --verify-tag

      - name: Dispatch downstream bump
        env:
          GH_TOKEN: ${{ secrets.DISPATCH_PAT }}
          DOWNSTREAM: EdgeSync
          MODULE_PATH: github.com/danmestas/go-libfossil
        run: |
          gh api -X POST "repos/danmestas/${DOWNSTREAM}/dispatches" \
            -f event_type=upstream-bump \
            -f client_payload[repo]=${{ github.event.repository.name }} \
            -f client_payload[module_path]=${MODULE_PATH} \
            -f client_payload[version]=${{ github.ref_name }} \
            -f client_payload[release_url]=${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }} \
            -f client_payload[tag_sha]=${{ github.sha }} \
            -f client_payload[actor]=${{ github.actor }}