Skip to content

Add script to automate release of new versions - #216

Open
jntesteves wants to merge 1 commit into
flathub:masterfrom
jntesteves:feature/release-automation-2
Open

jntesteves wants to merge 1 commit into
flathub:masterfrom
jntesteves:feature/release-automation-2

Conversation

@jntesteves

@jntesteves jntesteves commented Feb 17, 2022

Copy link
Copy Markdown
Contributor

New year, new PR. Same issues... Still trying to resolve #189

So, what changed:
I've come to accept that I'll never reach out to the guys on Discord to work on the upstream CI, so the problem has to be solved on this repository alone. I've decided to use the GitHub API to get the last commit hashes from the repositories of the modules and just update the template with that. Sounds like a cheap lazy excuse of a solution, but in fact it works much better than I expected.

I've just created a test release on a local branch with this command:

[UPDATED with the changes discussed in comments below]

./release.sh --git-tag=v1.10.0 1.10.0+test.0

You can use --help to get the usual usage help. Note that the script commits to git and creates a tag, so use a branch to test and take care not to push test releases.

This time it works, I swear.

@flathubbot

Copy link
Copy Markdown

Started test build 78771

@jntesteves
jntesteves force-pushed the feature/release-automation-2 branch from 5f10034 to 9abaeb6 Compare February 17, 2022 03:31
@flathubbot

Copy link
Copy Markdown

Started test build 78772

@flathubbot

Copy link
Copy Markdown

Build 78771 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/76651/org.libretro.RetroArch.flatpakref

@flathubbot

Copy link
Copy Markdown

Build 78772 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/76652/org.libretro.RetroArch.flatpakref

@RobLoach

Copy link
Copy Markdown
Collaborator

Very cool! Could we disable push by default? Or enable --no-push by default? Thanks for taking this on. Even having the latest commit attached is a huge step in the right direction.

@jntesteves
jntesteves force-pushed the feature/release-automation-2 branch from 9abaeb6 to 78999f7 Compare February 17, 2022 13:17
@flathubbot

Copy link
Copy Markdown

Started test build 78796

@jntesteves

Copy link
Copy Markdown
Contributor Author

Very cool! Could we disable push by default? Or enable --no-push by default? Thanks for taking this on. Even having the latest commit attached is a huge step in the right direction.

Yes, I inverted the option to --push and just force-pushed the change. Since this was supposed to run on CI, I didn't think much of ergonomics for local use, but yeah, not pushing by default makes much more sense.

@flathubbot

Copy link
Copy Markdown

Build 78796 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/76676/org.libretro.RetroArch.flatpakref

@jntesteves
jntesteves force-pushed the feature/release-automation-2 branch from 78999f7 to fae0d5e Compare February 18, 2022 18:05
@flathubbot

Copy link
Copy Markdown

Started test build 78912

@flathubbot

Copy link
Copy Markdown

Build 78912 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/76795/org.libretro.RetroArch.flatpakref

@RobLoach

RobLoach commented Mar 5, 2022

Copy link
Copy Markdown
Collaborator

Seem to be getting this error when running. Am I running it wrong?

./release.sh --git-tag=v1.10.1 1.10.1           
2022-03-04T19:13:55-05:00 INFO Rendering template from org.libretro.RetroArch.json.tmpl with VERSION_TAG=v1.10.1 to file org.libretro.RetroArch.json
./release.sh: 140: local: {: bad variable name

@jntesteves

Copy link
Copy Markdown
Contributor Author

Seem to be getting this error when running. Am I running it wrong?

./release.sh --git-tag=v1.10.1 1.10.1           
2022-03-04T19:13:55-05:00 INFO Rendering template from org.libretro.RetroArch.json.tmpl with VERSION_TAG=v1.10.1 to file org.libretro.RetroArch.json
./release.sh: 140: local: {: bad variable name

Hi, thanks for testing this. So, shell script is a complicated beast compatibility-wise. This seems to be a problem with dash and non-quoted variable assignment. I've used the opportunity while working on this script to improve my knowledge of POSIX-compliant shell script, testing with bash, dash, zsh and ash/busybox on an Alpine container, and still I let this one slip. That's how hard shell compatibility is.

What shell are you using? What OS?

PS: I just fixed it, but the fix broke zsh 😬

@RobLoach

RobLoach commented Mar 5, 2022

Copy link
Copy Markdown
Collaborator

We could flip it to use Node.js, or Python, or anything 🤷

@jntesteves

Copy link
Copy Markdown
Contributor Author

We could flip it to use Node.js, or Python, or anything shrug

I wanted something with no dependencies, so it would run on any CI server so I wouldn't need to care to ask what's running on it. And I also wanted to improve my script-fu. And shell script always feels like a good fit for build automation.

Anyway, I fixed it, it was just some creative quoting on my part. Quoting rules are by far the most complicated part of shell script in my opinion. I'm waiting one hour just to test some more. Github has a very low rate limit for their API, I can only test the script about 7 times before hitting it.

@jntesteves
jntesteves force-pushed the feature/release-automation-2 branch from fae0d5e to 7fdaea9 Compare March 5, 2022 01:52
@flathubbot

Copy link
Copy Markdown

Started test build 80480

@jntesteves

Copy link
Copy Markdown
Contributor Author

@RobLoach I've amended and force-pushed it. Tested with on every shell this time.

@flathubbot

Copy link
Copy Markdown

Build 80480 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/78373/org.libretro.RetroArch.flatpakref

@RobLoach RobLoach added the Hold label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep updated with upstream releases

3 participants