-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
apply beta versioning (git shorthash) to github action builds #3486
base: master
Are you sure you want to change the base?
Conversation
Oopsie misclicked on my phone |
This is cursed, why do we need Javascript to parse a gradle properties? Frankly it might be better to always include the commit hash, then manually remove it when making a release, that way it's never ambiguous which download jars are accurate and official |
they do also run shell scripts, I guess I could've used |
yes that's what this does, unless you also mean when people manually build it themselves, that's harder |
Idk I really don't like this approach, using Javascript in a github action to rewrite the gradle.properties file makes my skin crawl. :( I think this logic would better belong in https://github.com/cabaletta/baritone/blob/master/buildSrc/src/main/java/baritone/gradle/task/CreateDistTask.java
Wait then what's the point of |
Assuming git is installed on the CI I'd suggest using the output of Also I'd prefer having this version scheme for local builds as well, preferably with something like the Even if you keep the current behavior, please at least pass the value as a |
good idea, I'm gonna have to steal that for my CI's as well xd |
@ZacSharp I've implemented your suggestion in a way I think will work good, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much cleaner now.
Looking at the CI https://github.com/cabaletta/baritone/actions/runs/2437026172, I see What does the |
Kinda. Got the versioning to work with either ...
steps:
....
- name: Determine version (pull request)
if: github.event_name == 'pull_request'
run: echo version="$(git describe --always --tags ${{github.event.pull_request.head.sha}})+$(git describe --always --tags ${{github.event.pull_request.base.sha}})" >> $GITHUB_ENV
- name: Determine version (other)
if: github.event_name != 'pull_request'
run: echo version="$(git describe --always --tags ${{github.sha}})" >> $GITHUB_ENV
- run: echo ${{env.version}} or job:
....
env:
ref: ${{github.sha}}
steps:
....
- name: Use pull request head for versioning
if: github.event_name == 'pull_request'
run: echo ref="${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
- run: echo $(git describe --always --tags ${{env.ref}}) ( Getting this to work with prs and pushes the seems to cause some complication so I wonder whether we might want to go for the improper solution and just use I also got the limited clone with history to work with ....
steps:
- uses: actions/checkout@v2
- name: Fetch history
run: git fetch --unshallow --filter=tree:0 origin $GITHUB_REF
- name: Fetch tags
run: git fetch origin +refs/tags/*:refs/tags/* |
@ZacSharp I've updated the pr per your suggestions, made some modifications to make it a bit nicer. thoughts? |
This doesn't show from which commit of a pr the artifact was generated, which would be of interest e.g. in case a frequently used pr like the one for 1.19.2 needs a bugfix. I messed up with the fetching (sorta) and it fetches nearly all commits; but without contents so it's still not a heavy full clone. As of now I neither have a solution to this nor do I think it is important. All tests I did (push and pr with and without available tag) worked, so apart from not showing the pr hash this looks good. |
Oh, I though it was target commit plus pr number, but it's pr commit plus pr number. |
Did you actually test this without git installed? |
I guess replacing the command for testing has to do the job then. |
yeah. that works I guess. fixed |
Co-authored-by: ZacSharp <68165024+ZacSharp@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buildscript only uses tags starting with "v", the CI uses any tag. I think they should behave the same.
Also I'm done with clicking through slow GitHub UIs and won't do any more CI tests. Here's the table for the last batch I've done:
CI push | CI pr | local | local with changes | |
---|---|---|---|---|
with tag | ✔ | ✔ | ✔ | ✔ |
with invalid tag | see above | see above | ✔ | ✔ |
without tag | ✔ | ✔ | ✔ | ✔ |
"without git" | No | No | ✔ | No |
git inserts a v at the beginning of the tags. that's what the |
That's fine as long as we can be sure the CI will only ever find version tags. Otherwise it will e.g. turn tag "refactor" into version "efactor". |
so, which command do I add what to? |
Sorry, my bad. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I meant.
If using non-version tags is desired then we should instead do
- if (!vers.startsWith("v")) {
+ if (vers.equals("")) {
or whatever else checks for vers being the empty string.
Co-authored-by: ZacSharp <68165024+ZacSharp@users.noreply.github.com>
Co-authored-by: ZacSharp <68165024+ZacSharp@users.noreply.github.com>
Co-authored-by: ZacSharp <68165024+ZacSharp@users.noreply.github.com>
baritone version with
git describe --always --tags | cut -c2-
on github action buildsgreat for users who report issues on unreleased versions as we can see exactly what commit they were using