sbt / sbt-ci-release

sbt plugin to automate Sonatype releases from GitHub Actions
Apache License 2.0
286 stars 76 forks source link

Version issue when using with githubflow #187

Closed gzoller closed 3 years ago

gzoller commented 3 years ago

I'm using githubflow to manage branches and tag versions. The tag is created with I do a

git hf release finish v1.2.3

I've got a yml in my workflows folder that triggers a GitHub action when this tag is created:

name: Release
on:
  create:  # Publish release on tag creation

jobs:
  publish:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2.3.4
        if: github.event.ref_type == 'tag'
        with:
          fetch-depth: 0
      - uses: olafurpg/setup-scala@v10
        if: github.event.ref_type == 'tag'
      - uses: olafurpg/setup-gpg@v3
        if: github.event.ref_type == 'tag'
      - run: sbt ci-release
        if: github.event.ref_type == 'tag'
        env:
          PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
          PGP_SECRET: ${{ secrets.PGP_SECRET }}
          SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
          SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

This actually runs when its supposed to (when I finish the release) and actually publishes to Sonatype, so I must have correctly set all my tokens (yay!). But... what I see isn't version 1.2.3. The version I see is b4e7bd_unknown, which I presume is some mash-up of the git commit id.

How can I modify my publish script, preferably without changing when it runs, to correctly version from the created tag?

gzoller commented 3 years ago

Never mind. This is an issue with my packager for gitflow. GitHub changed master to main, which screwed up some logic.