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

Add stable branch to release.sh #2236

Merged
merged 3 commits into from Jan 31, 2024

Conversation

antonsoroko
Copy link
Contributor

@antonsoroko antonsoroko commented Jan 30, 2024

To be used in PPA builds.

for #2186 (comment)

this will allow to make PPA build without manual changing of tag name in PPA recipe every time there is a release, instead we will use "stable" branch as branch name.

Tested by creating new releases:
from https://github.com/antonsoroko/Solaar/tree/version_1.1.11 i created
https://github.com/antonsoroko/Solaar/tree/1.1.11
and https://github.com/antonsoroko/Solaar/tree/stable used to point to that 1.1.11 tag.

then from https://github.com/antonsoroko/Solaar/tree/version_1.1.12 i created
https://github.com/antonsoroko/Solaar/tree/1.1.12
and https://github.com/antonsoroko/Solaar/tree/stable points to that new 1.1.12 tag.

see https://github.com/antonsoroko/Solaar/commits/stable/

To be used in PPA builds.
@pfps
Copy link
Collaborator

pfps commented Jan 30, 2024

Looks good. Will this also update stable to release candidate builds?

@pfps pfps self-requested a review January 30, 2024 19:53
Copy link
Collaborator

@pfps pfps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll merge when the question about release candidate builds is answered.

@antonsoroko
Copy link
Contributor Author

antonsoroko commented Jan 31, 2024

@pfps Good question. It will update stable to RC release as well. Although, now my question is - should we do this or not?
If RC is considered as stable - then yes. If it is not considered as stable - then i can add condition to ignore RC releases.

Test:
from https://github.com/antonsoroko/Solaar/tree/version_1.1.13rc1
created tag - https://github.com/antonsoroko/Solaar/tree/1.1.13rc1
updated stable - https://github.com/antonsoroko/Solaar/tree/stable

This is how script works now (debug output):
$ bash -x ./release.sh
+ repo=pwr-Solaar/Solaar
+ '[' 0 '!=' 0 ']'
++ cat lib/solaar/version
+ version=1.1.13rc1
+ prerelease=false
+ echo 1.1.13rc1
+ grep '.*rc.*'
+ '[' 0 -eq 0 ']'
+ prerelease=true
+ stable_branch=stable
++ git symbolic-ref HEAD
+ ref=refs/heads/version_1.1.13rc1
+ '[' 0 -ne 0 ']'
+ branch=version_1.1.13rc1
++ git rev-list --max-count=1 HEAD
+ commit=15898c0738c00f07ca1c9293ea34e04a9be481e9
+ '[' 0 -ne 0 ']'
++ git config --get branch.version_1.1.13rc1.remote
+ remote=origin
+ '[' 0 -ne 0 ']'
++ git config --get branch.version_1.1.13rc1.merge
+ remote_ref=refs/heads/version_1.1.13rc1
+ '[' 0 -ne 0 ']'
+ remote_branch=version_1.1.13rc1
++ cat /home/USER/.github-token
+ github_token=XXX
+ '[' 0 -ne 0 ']'
+ jq -V
+ '[' 0 -ne 0 ']'
+ echo -e '\n\t** You are tagging a release for version 1.1.13rc1 **\n'

** You are tagging a release for version 1.1.13rc1 **

+ echo 'Version: 1.1.13rc1'
Version: 1.1.13rc1
+ echo 'Commit: 15898c0738c00f07ca1c9293ea34e04a9be481e9'
Commit: 15898c0738c00f07ca1c9293ea34e04a9be481e9
+ echo 'Pre-release: true'
Pre-release: true
+ echo 'Remote: origin'
Remote: origin
+ '[' version_1.1.13rc1 == version_1.1.13rc1 ']'
+ echo 'Branch: version_1.1.13rc1'
Branch: version_1.1.13rc1
+ echo -e '\nPlease read RELEASE.md before continuing.\n'

Please read RELEASE.md before continuing.

+ read -p 'Are you sure you want to proceed? (y/n) ' -n 1 -r
Are you sure you want to proceed? (y/n) y+ echo

+ [[ ! y =~ ^[Yy]$ ]]
+ read -p 'Are you *really* sure you want to proceed? (y/n) ' -n 1 -r
Are you *really* sure you want to proceed? (y/n) y+ echo

+ [[ ! y =~ ^[Yy]$ ]]
+ grep '^# 1.1.13rc1' ChangeLog.md
+ '[' 0 -ne 0 ']'
+ git diff --quiet HEAD
+ '[' 0 -ne 0 ']'
+ git show -s --format=%B HEAD
+ grep '^release 1.1.13rc1'
++ git rev-list --max-count=1 origin/version_1.1.13rc1
+ remote_commit=15898c0738c00f07ca1c9293ea34e04a9be481e9
+ '[' 0 -ne 0 ']'
+ '[' 15898c0738c00f07ca1c9293ea34e04a9be481e9 '!=' 15898c0738c00f07ca1c9293ea34e04a9be481e9 ']'
+ git rev-list --max-count=1 1.1.13rc1
+ '[' 128 -eq 0 ']'
+ git ls-remote origin
+ grep 'refs/tags/1.1.13rc1$'
+ '[' 1 -eq 0 ']'
+ echo

+ echo 'Creating tag...'
Creating tag...
+ echo 'release 1.1.13rc1'
+ echo
+ found=no
+ read -r line
+ [[ # 1.1.13rc1 == \#\ * ]]
+ '[' '# 1.1.13rc1' == '# 1.1.13rc1' ']'
+ found=yes
+ '[' yes == yes ']'
+ '[' '#' == '*' ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' yes == yes ']'
+ '[' '' == '*' ']'
+ read -r line
+ [[ * release candidate test 1 == \#\ * ]]
+ '[' yes == yes ']'
+ '[' '*' == '*' ']'
+ echo '* release candidate test 1'
+ read -r line
+ [[ * release candidate test 2 == \#\ * ]]
+ '[' yes == yes ']'
+ '[' '*' == '*' ']'
+ echo '* release candidate test 2'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' yes == yes ']'
+ '[' '' == '*' ']'
+ read -r line
+ [[ # 1.1.12 == \#\ * ]]
+ '[' '# 1.1.12' == '# 1.1.13rc1' ']'
+ found=no
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Test release2 == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * With test script2 == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * With test changes2 == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ # 1.1.11 == \#\ * ]]
+ '[' '# 1.1.11' == '# 1.1.13rc1' ']'
+ found=no
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Test release == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * With test script == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * With test changes == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ # 1.1.10 == \#\ * ]]
+ '[' '# 1.1.10' == '# 1.1.13rc1' ']'
+ found=no
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Add information about NixOS flake package == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Add symbolic version of solaar icon == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Put version in initial INFO logging message == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ # 1.1.9 == \#\ * ]]
+ '[' '# 1.1.9' == '# 1.1.13rc1' ']'
+ found=no
+ '[' no == yes ']'
+ read -r line
+ [[ '' == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Add descriptors for G535 wireless gaming headset and wireless keyboard EX110 == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Update Greek translation == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ [[ * Fix minor issues in documentation == \#\ * ]]
+ '[' no == yes ']'
+ read -r line
+ '[' -z '' ']'
+ git tag -s 1.1.13rc1 -F /tmp/solaar-changelog
+ '[' 0 -ne 0 ']'
+ echo 'Pushing tag...'
Pushing tag...
+ '[' -z '' ']'
+ git push origin 1.1.13rc1
Перечисление объектов: 1, готово.
Подсчет объектов: 100% (1/1), готово.
Запись объектов: 100% (1/1), 718 байтов | 718.00 КиБ/с, готово.
Всего 1 (изменений 0), повторно использовано 0 (изменений 0), повторно использовано пакетов 0
To github.com:antonsoroko/Solaar.git
* [new tag]         1.1.13rc1 -> 1.1.13rc1
+ '[' 0 -ne 0 ']'
+ echo 'Updating stable branch...'
Updating stable branch...
+ '[' -z '' ']'
+ git rev-list --max-count=1 stable
+ '[' 0 -ne 0 ']'
+ git checkout stable
Переключено на ветку «stable»
+ git merge --ff 1.1.13rc1
Обновление bfed195..15898c0
Fast-forward
ChangeLog.md                                          | 5 +++++
lib/solaar/version                                    | 2 +-
release.sh                                            | 6 +++---
share/solaar/io.github.pwr_solaar.solaar.metainfo.xml | 3 +++
4 files changed, 12 insertions(+), 4 deletions(-)
+ git push origin stable
Всего 0 (изменений 0), повторно использовано 0 (изменений 0), повторно использовано пакетов 0
To github.com:antonsoroko/Solaar.git
bfed195..15898c0  stable -> stable
+ git checkout version_1.1.13rc1
Переключено на ветку «version_1.1.13rc1»
Ваша ветка обновлена в соответствии с «origin/version_1.1.13rc1».
+ echo 'Creating github release...'
Creating github release...
+ '[' -z '' ']'
++ jq -r .html_url
+++ body
+++ cat
++++ awk '{printf "%s\\n", $0}' /tmp/solaar-changelog
++ curl -H 'Authorization: $github_token' -X POST --data '{
"tag_name": "1.1.13rc1",
"name": "1.1.13rc1",
"body": "release 1.1.13rc1\n\n* release candidate test 1\n* release candidate test 2\n",
"prerelease": true,
"draft": false
}' https://api.github.com/repos/pwr-Solaar/Solaar/releases
+ url=null
+ '[' -z '' ']'
+ '[' -z null ']'
+ '[' -z '' ']'
+ echo -e '\nRelease created: null'

Release created: null
+ rm /tmp/solaar-changelog

@pfps
Copy link
Collaborator

pfps commented Jan 31, 2024

RC releases are test releases so I would count them as not stable.

@antonsoroko
Copy link
Contributor Author

@pfps okay then. i update script to skip prerelease.

@pfps pfps merged commit 5392eeb into pwr-Solaar:master Jan 31, 2024
1 check passed
@antonsoroko
Copy link
Contributor Author

@pfps can you please create a stable branch right now (i mean without waiting for new release) by doing:
git checkout 1.1.10
git switch -c stable
git push (or git push --set-upstream origin)

@pfps
Copy link
Collaborator

pfps commented Jan 31, 2024

Should be done. I had to use

git push --set-upstream origin stable

but there is a stable branch that appears to be 1.1.10

@antonsoroko
Copy link
Contributor Author

@pfps thanks. that's probably because you do not have push.autoSetupRemote enabled in git - see https://adamj.eu/tech/2022/10/31/git-how-to-automatically-create-upstream-branches/

i set it to true to get rid of that annoying "git push" failure with new local branches.

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.

None yet

2 participants