Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm Cargo Version matches Tag Version in release CI/CD workflow #4

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

FxllenCode
Copy link

Resolves #3

Done:

  • Find the cargo version from the Cargo.toml file.
  • Add a v to the version within the workflow.
  • Cancel the workflow if the two do not match up.

Todo:

  • Figure out why github.ref is not returning the current tag.
  • Complete the semi-automation of releases in the CI workflow.

If I can figure out why I cannot get the tag using github.ref, everything else should be pretty much done from there.

Thanks!

@FxllenCode
Copy link
Author

P.S. I'll squash the commits if that's easier for you - was annoying to test the workflows out without commiting! 😂

@Sleitnick
Copy link
Owner

Thanks for the work on this! I'll test this out later and then merge it in.

@FxllenCode
Copy link
Author

Thanks for the work on this! I'll test this out later and then merge it in.

Just to clarify - this is still a draft pr. I've been struggling to get the tag name from the CI. I tried with github.ref and it did not work as intended.

@Sleitnick
Copy link
Owner

Sleitnick commented Aug 1, 2022

If it helps, this is how I do it in my other project: https://github.com/Sleitnick/Knit/blob/main/.github/workflows/release.yaml#L48
${GITHUB_REF#refs/tags/}

@Sleitnick
Copy link
Owner

So maybe it could look something like this?

      - name: Get the tag of current release
        id: get_version
        run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}

      - name: Verify package version is equal to tag version
        if: ${{ steps.cargo_version.outputs.value != steps.get_version.outputs.VERSION }}
        run: |
          echo "${{ steps.cargo_version.outputs.value }}"
          echo "${{ steps.get_version.outputs.VERSION }}"
          exit 1

@Sleitnick
Copy link
Owner

If you wanna make those changes, I'll pull this in!

@FxllenCode
Copy link
Author

Hey sorry about that @Sleitnick will get to it ASAP!

@Sleitnick
Copy link
Owner

No problem; no rush

@FxllenCode
Copy link
Author

Hm @Sleitnick... I still could not get it implemented with the changes you requests, you should be able to add a commit re if you want to take a stab at seeing what's wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify tag version matches cargo version
2 participants