Merge pull request #11788 from dacook/release-scripts

Add script for preparing translations
This commit is contained in:
Gaetan Craig-Riou
2023-11-10 13:56:04 +11:00
committed by GitHub
4 changed files with 46 additions and 15 deletions

View File

@@ -10,21 +10,11 @@ assignees: ''
## 1. Preparation on Thursday
- [ ] Merge pull requests in the [Ready To Go] column
- [ ] Include translations
<details><summary>Command line instructions:</summary>
<pre>
<code>
git checkout master
git pull upstream master
tx pull --force
git commit -a -m "Update all locales with the latest Transifex translations"
git push upstream master
</code>
</pre>
</details>
- [ ] Create a tag:
- `script/tag_release` will auto increment patch version, otherwise
- `git push upstream HEAD:refs/tags/vX.Y.Z`
- [ ] Include translations: `script/release/udpate_locales`
- [ ] Increment version number: `git push upstream HEAD:refs/tags/vX.Y.Z`
- Major: if server changes are required (eg. provision with ofn-install)
- Minor: larger change that is irreversible (eg. migration deleting data)
- Patch: all others. Shortcut: `script/release/tag`
- [ ] [Draft new release]. Look at previous [releases] for inspiration.
- Select new release tag
- _Generate release notes_ and check to ensure all items are arranged in the right category.

13
script/release/prepare Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# Execute preparation tasks for a regular patch release. Requires admin permission on the repo.
#
set -e
# todo: ask to confirm, and remind to check the ready to go column.
# Download translations and push to master
$(dirname "$0")/update_locales
# Bump the patch version and push the tag
$(dirname "$0")/tag

View File

@@ -5,6 +5,8 @@
# This supports only patch releases at the moment but can be developed
# further.
puts "\n*** Fetching latest release tag... ***\n"
# Fetch current tags first:
`git fetch upstream --tags`
@@ -18,7 +20,10 @@ latest_version = Gem::Version.new(latest_tag[1..-1])
major, minor, patch = latest_version.segments
next_tag = "v#{major}.#{minor}.#{patch.succ}"
# Push the new tag
puts "\n*** Pushing new release tag #{next_tag}... ***\n"
puts `git push upstream 'HEAD:refs/tags/#{next_tag}'`
# Shortcuts
puts "Draft a new release with this tag:
https://github.com/openfoodfoundation/openfoodnetwork/releases/new?tag=#{next_tag}&title=#{next_tag}+Code+Name"

23
script/release/update_locales Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
# Download and commit the latest Transifex translations
#
# Exit on error or uncommitted changes
# TODO: check that master matches upstream/master
set -e
if [ ! -z "$(git status --porcelain)" ]; then
echo "Aborted: git working directory is not clean."
exit 1
fi
echo "\n*** Checking out latest master... ***\n"
git checkout master
git pull upstream master
echo "\n*** Downloading latest Transifex translations... ***\n"
tx pull --force
git commit -a -m "Update all locales with the latest Transifex translations"
echo "\n*** Pushing to master... ***\n"
git push upstream master