|
| 1 | +# Updating to a new version of Google's libphonenumber |
| 2 | + |
| 3 | +## Prepare the repo with required version and Annatel's changes |
| 4 | + |
| 5 | +- If you don't already have it, get Annatel's fork of libphonenumber : `git clone git@github.com:annatel/libphonenumber.git` |
| 6 | +- cd libphonenumber/ |
| 7 | +- If you didn't already add it, add Google's version as upstream : `git remote add upstream git@github.com:google/libphonenumber.git` |
| 8 | +- fetch all changes and tags : `git fetch --all --tag` |
| 9 | +- find what was the latest version from Annatel (e.g. vP.RE.V) : `git branch -r | grep antl` |
| 10 | +- checkout that version : `git checkout vP.RE.V` |
| 11 | +- update it to latest commit: `git pull` |
| 12 | +- create a local branch for your new version basing it ont the tag from Google that you're interested in (e.g. vL.AS.T): `git checkout -b antl-vL.AS.T vL.AS.T` |
| 13 | +- apply Annatel's diff to your new branch : `git diff vP.RE.V..antl-vP.RE.V | git apply -` |
| 14 | + If it doesn't work automatically you'll have to do it manually, try that alternative procedure : |
| 15 | + - `git diff vP.RE.V..antl-P.RE.V > patch.diff` |
| 16 | + - edit patch.diff, save all hunks that are not problematic in a new file named p1.diff and the problematic ones in p2.diff |
| 17 | + - `git apply p1.diff` |
| 18 | + - manually apply p2.diff (probably changes regarding `resources/PhoneNumberMetadata.xml` — WARNING: do **NOT** put comments inside tags) |
| 19 | +- if you need to add other changes, add them now.(find other ranges (i.e. M2M, IOT...) at : https://data.gov.il/dataset/israel-numbering-plan/resource/74b44725-d8cc-4ae9-ba08-2c40a61ab68e) |
| 20 | +- check that the changes look good; you should see a small number (~4) of new or changed files: `git status` |
| 21 | +- if you need to do other changes, fix previous changes, etc, do it now. If you see that there is a previously added hotfix, try to see if it is possible to remove it with this new version |
| 22 | +- add the files to a new commit : `git add .github/workflows/release.yml Earthfile resources/PhoneNumberMetadata.xml README-Annatel.md ... your files` |
| 23 | +- commit : `git commit -m "Annatel internal changes"` |
| 24 | +- push your new branch : `git push --set-upstream origin antl-vL.AS.T` |
| 25 | + |
| 26 | +## Release the new version |
| 27 | + |
| 28 | +- go to https://github.com/annatel/libphonenumber/ |
| 29 | +- In the right colmn, click on "Releases" |
| 30 | +- click on "Draft a new release" |
| 31 | +- click on the "Choose a tag" dropdown |
| 32 | +- in the "Find or create a new tag" field enter a name for the tag of the new release, (e.g. vL.AS.T-antl-0.42.0) |
| 33 | +- click on the "Target: master" dropdown |
| 34 | +- in the "Branches" tab, chose the branch you created earlier (e.g. antl-vL.AS.T) |
| 35 | +- click on the "Publish release" button |
| 36 | +- you should now see the page of the release you just created but the assets.zip file is not there yet in the "Assets" files list |
| 37 | +- wait approximately 5 minutes (You can check if it is finished in the "Actions" tab) |
| 38 | +- reload the page of the release |
| 39 | +- you should now see the assets.zip file in the "Assets" file list |
| 40 | +- done ✅ |
| 41 | + |
| 42 | +## Check the new version |
| 43 | + |
| 44 | +Update antl_phonenumber: |
| 45 | +- go to your antl_phonenumber worktree and update it : `cd ../antl_phonenumber && git pull` |
| 46 | +- **if you changed Google's metadata, add relevant test numbers to `test/annatel_test_numbers.csv`** |
| 47 | +- update `Earthfile` to use your new version of the libphonenumber assets |
| 48 | +- check that all tests pass **with earthly** (it will automatically add Annatel specific tests) : `earthly -P +test` |
| 49 | + |
| 50 | + |
| 51 | +## Use the new version |
| 52 | + |
| 53 | +You can now update the Earthfile of your projects with the url of the new assets.zip file. |
| 54 | + |
| 55 | +Be carefull, it often appears twice in internal projects Earthfiles. |
| 56 | + |
0 commit comments