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

fix: non latest version matching #12

Merged
merged 3 commits into from
Aug 23, 2022
Merged

fix: non latest version matching #12

merged 3 commits into from
Aug 23, 2022

Conversation

userdocs
Copy link

@userdocs userdocs commented Aug 22, 2022

Problem: When using an index value to assume the position of the pre release release we want, we may get a wrong version, as happened when I built a custom version of 4.3.9 as a pre-release after the normal build process. This led to release-4.4.3.1_v1.2.17 being downgraded to release-4.3.9_v1.2.17 at the index position [0] of the pre re was replaced by this new pre release.

Solution: My releases provide a dependency-version.json as a released file which can cleanly let us know the specific version of qbittorrent on the latest release without any fancy or complicated checks. So we can quickly determine the release value we need to know to determine which pre release we want. So we set this to a variable like this

qbts_latest_release="$(curl -sL https://github.com/userdocs/qbittorrent-nox-static/releases/latest/download/dependency-version.json | jq -r '.qbittorrent')"

Using this version variable we can be more specific with jq about what we are looking for by returning the first result of a targeted search/filter value instead of looking at the index position [0]

jq -r 'first(.[] | select(.tag_name | contains ("release-'"${qbts_latest_release}"_v1.2.'")) | .tag_name)'

If we don't filter the first result and see them all we get this, for example.

jq -r '.[] | select(.tag_name | contains ("release-'"${qbts_latest_release}"_v1.2.'")) |
.tag_name'
release-4.4.3.1_v1.2.17
release-4.4.3.1_v1.2.16

I think this is a better approach to determining the release value we want as it will ignore index value shifts and always produce a more targeted and relevant result.

It worked in my testing but I have not tested the build process itself so it needs double checking to make sure it solves the problem.

@mrhotio mrhotio merged commit 142ff85 into hotio:release Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants