nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
256 stars 28 forks source link

Documentation unclear on how the github-release command works #52

Closed rodrigogiraoserrao closed 2 years ago

rodrigogiraoserrao commented 2 years ago

I was trying to use the command scriv github-release to publish a release, but I haven't been successful. Every time I try, I get this message:

λ scriv github-release
warning: Version 0.1.0 has no tag. No release will be made.

I tried creating tags for version 0.1.0 in three different ways:

git tag 0.1.0
git tag v0.1.0
git tag -a v0.1.0 -m "My annotation here."

None of these seem to work 🤷

nedbat commented 2 years ago

Can you show the contents of the changelog, and the output of git tags when you get that error?

rodrigogiraoserrao commented 2 years ago
λ git tag
v0.1.0

(Like I said, I tried this with 0.1.0 and v0.1.0.)

The contents of CHANGELOG.md are as follows:

# Changelog

<!--scriv-insert-here-->

<a id='changelog-0.1.0'></a>
# 0.1.0 — 2022-06-22

## Added

- Classes `ExtendedEncoder` and `ExtendedDecoder` to allow extension of the JSON format.
<!--scriv-end-here-->

Taken from the extendedjson repository.

rodrigogiraoserrao commented 2 years ago

Seems like the issue is that the command is git tag and you coded it as git tags:

https://github.com/nedbat/scriv/blob/6d89d51bfd81b300e35188585e655492c4fdf55d/src/scriv/ghrel.py#L28

Changing that to git tag makes some progress, but I'm getting some 404 errors. I'm trying to understand if that's on me or not.

rodrigogiraoserrao commented 2 years ago

My understanding of what's happening is this:

It seems like the follow-up issue is that you are trying to create/update the release through an API without doing any sort of authentication whatsoever, so it simply doesn't work. You can list tags and etc. because you resort to running the git commands in the command line, and I'm already auth'ed in the command line, but then you try issuing a regular POST request with requests, and that has no way of knowing that's an authorised POST request.

Please do correct me if I'm wrong.

nedbat commented 2 years ago

Whoops, good catch on the git command. I have an alias for "git tags" because I could never remember the real name. I've fixed that. The authentication is implicit through .netrc. I guess I should provide some explicit options, and documentation.

rodrigogiraoserrao commented 2 years ago

The authentication is implicit through .netrc. I guess I should provide some explicit options, and documentation.

Is that going to work on Windows as well? That sounds like a Linux/Unix thing.

nedbat commented 2 years ago

Can you try the latest tip of main? If you put a personal access token in GITHUB_TOKEN, it should work.

rodrigogiraoserrao commented 2 years ago

Installing the latest tip of main with python -m pip install -e git+https://github.com/nedbat/scriv.git@56297c7ddd3fb24d6aa827b28a8509ad5f206d47#egg=scriv[toml] and then setting a personal access token in the environment variable GITHUB_TOKEN makes it work, yes! 🎉

nedbat commented 2 years ago

This is now released as part of scriv 0.16.0.

mhered commented 2 years ago

Dumb question here, how do you set environment variable GITHUB_TOKEN with your personal access token? I tried $ export GITHUB_TOKEN=myPAT from within the poetry shell I use as environment and didn't work. Also, this seems to be deleted every time I launch the environment anew.

step21 commented 2 years ago

Dumb question here, how do you set environment variable GITHUB_TOKEN with your personal access token? I tried $ export GITHUB_TOKEN=myPAT from within the poetry shell I use as environment and didn't work. Also, this seems to be deleted every time I launch the environment anew.

What you did should work. To load it automatically, you could put it into a file loaded when you load the virtual env or when you start your shell. Specific vary depending on system, shell etc.

nedbat commented 2 years ago

I added more explanation in 4f1ceca7bd283484d3f12a6dbc5feb953ec1be2e.