Skip to content

Commit

Permalink
Kiwix Apple repository is now kiwix/kiwix-apple
Browse files Browse the repository at this point in the history
  • Loading branch information
kelson42 committed Mar 31, 2024
1 parent e8a9568 commit 2212d6d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- main

# taken from: kiwix/apple .github/workflows/cd.yml
# taken from: kiwix/kiwix-apple .github/workflows/cd.yml
env:
KEYCHAIN: /Users/runner/build.keychain-db
KEYCHAIN_PASSWORD: mysecretpassword
Expand All @@ -23,7 +23,7 @@ jobs:
- platform: macOS
- platform: iOS
xcode_extra: -sdk iphoneos
runs-on: macos-13
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -32,31 +32,31 @@ jobs:

- name: Set tag variable as an output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Validate tag
run:
run:
|
cd custom
python src/tag_validator.py ${{ steps.vars.outputs.tag }}
cd ..

- name: Check-out kiwix/apple
- name: Check-out kiwix/kiwix-apple
uses: actions/checkout@v4
with:
repository: kiwix/apple
repository: kiwix/kiwix-apple
path: apple

- name: Install Python dependencies for custom project generation
run: python -m pip install pyyaml

- name: Install Kiwix dependencies
run: | # remove pre-commit, it's not needed for CI
run: | # remove pre-commit, it's not needed for CI
cd apple
cat Brewfile | grep -v -e pre-commit > Brewfile_CI
brew bundle --force --file Brewfile_CI
cd ..
- name: Generate project based on tag
env:
DWDS_HTTP_BASIC_ACCESS_AUTHENTICATION: ${{ secrets.DWDS_HTTP_BASIC_ACCESS_AUTHENTICATION }}
Expand All @@ -75,10 +75,10 @@ jobs:
# move the custom project file to the main folder
mv custom_project.yml ../
cd ..

# run xcodegen on our custom project
xcodegen -s custom_project.yml

ls -la


Expand All @@ -92,8 +92,8 @@ jobs:
VERSION=$(<./apple/custom/.version_number)
echo "VERSION=$VERSION" >> $GITHUB_ENV
# taken from: kiwix/apple .github/workflows/cd.yml
# taken from: kiwix/kiwix-apple .github/workflows/cd.yml
- name: Set up variables for build
env:
PLATFORM: ${{ matrix.destination.platform }}
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches:
- main

# taken from: kiwix/apple .github/workflows/cd.yml
# taken from: kiwix/kiwix-apple .github/workflows/cd.yml
env:
KEYCHAIN: /Users/runner/build.keychain-db
KEYCHAIN_PASSWORD: mysecretpassword
Expand All @@ -25,40 +25,40 @@ jobs:
- platform: macOS
- platform: iOS
xcode_extra: -sdk iphoneos
runs-on: macos-13
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: custom
path: custom

- name: Install Python dependencies for custom project generation
run: python -m pip install pyyaml

- name: Test python scripts
working-directory: custom
run: PYTHONPATH=src python -m unittest discover -s tests

- name: Set test tag variable as an output
id: vars
run: echo "tag=testapp_2023.12.1" >> $GITHUB_OUTPUT
run: echo "tag=testapp_2023.12.1" >> $GITHUB_OUTPUT

- name: Validate and parse the tag
working-directory: custom
run: python src/tag_validator.py ${{ steps.vars.outputs.tag }}

- name: Check-out kiwix/apple
- name: Check-out kiwix/kiwix-apple
uses: actions/checkout@v4
with:
repository: kiwix/apple
repository: kiwix/kiwix-apple
path: apple

- name: Install Kiwix dependencies
working-directory: apple
run: | # remove pre-commit, it's not needed for CI
run: | # remove pre-commit, it's not needed for CI
cat Brewfile | grep -v -e pre-commit > Brewfile_CI
brew bundle --force --file Brewfile_CI
- name: Generate project based on tag
env:
DWDS_HTTP_BASIC_ACCESS_AUTHENTICATION: ${{ secrets.DWDS_HTTP_BASIC_ACCESS_AUTHENTICATION }}
Expand All @@ -77,7 +77,7 @@ jobs:
# move the custom project file to the main folder
mv custom_project.yml ../
cd ..

# run xcodegen on our custom project
xcodegen -s custom_project.yml
ls -la
Expand All @@ -93,8 +93,8 @@ jobs:
VERSION=$(<./apple/custom/.version_number)
echo "VERSION=$VERSION" >> $GITHUB_ENV
# taken from: kiwix/apple .github/workflows/cd.yml
# taken from: kiwix/kiwix-apple .github/workflows/cd.yml
- name: Set up variables for build
env:
PLATFORM: ${{ matrix.destination.platform }}
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Therefore each brand will end up with 2 apps (one for iOS and one for macOS).

## At the beginning we have the following:
- custom brand folders, each with an info.json file, and xcassets
- we have the `kiwix/apple` code (as a seperate repository).
- we have the `kiwix/kiwix-apple` code (as a seperate repository).

We do not add any swift code to custom apps. All swift code related to custom apps is already included in `kiwix/apple` repository, it is just "not used" by the Kiwix apps.
We do not add any swift code to custom apps. All swift code related to custom apps is already included in `kiwix/kiwix-apple` repository, it is just "not used" by the Kiwix apps.

The `kiwix/apple` repo is checked out into `/apple` folder, while the custom app repo (this one), is checked out under `/custom` folder.
The `kiwix/kiwix-apple` repo is checked out into `/apple` folder, while the custom app repo (this one), is checked out under `/custom` folder.

Since most of the code and files are already in the `/apple` folder, we copy the `/custom` folder under it, so it ends up in: `/apple/custom`. We do the rest of the building from the `/apple` folder.

Expand All @@ -38,14 +38,14 @@ SETTINGS_SHOW_EXTERNAL_LINK_OPTION = NO
This way we end up with a plist file dedicated to a specific brand containing all the variables and values it needs.

## Enforced language?
If we use enforcing a language for a brand, what that really means is: we cannot use any of the localization folders contained in the main (kiwix/apple) repo, instead we need to make a copy of a single language folder, eg: `de.lproj` and place it into the custom folder eg: `/custom/dwds/de.lproj` and include only that in the project.
If we use enforcing a language for a brand, what that really means is: we cannot use any of the localization folders contained in the main (kiwix/kiwix-apple) repo, instead we need to make a copy of a single language folder, eg: `de.lproj` and place it into the custom folder eg: `/custom/dwds/de.lproj` and include only that in the project.

(Note: only including / excluding does not work as the references to those language folders in the final Xcode project file will mess up. So we need a copy of the enforced lang folder in the custom apps folder, and only this way it works as expected.)

An extra step is required here, we also need to set the DEVELOPMENT_LANGUAGE to this value (eg. "de").

# A new custom_project.yml file
The main `kiwix/apple` repo contains a `project.yml` file, it describes all the common build and project settings, and all the templates we re-use to create a final xcode project file, which is used to build the custom apps. At the end each custom app will be a separate target we can build.
The main `kiwix/kiwix-apple` repo contains a `project.yml` file, it describes all the common build and project settings, and all the templates we re-use to create a final xcode project file, which is used to build the custom apps. At the end each custom app will be a separate target we can build.
Therefore we dynamically create the `custom_project.yml` file, which will import the `project.yml`, and sets up the new targets (one for each brand), it looks more or less, like this:
```
include:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Kiwix Apple Custom Apps

Kiwix Apple custom apps are iOS/macOS apps running [Kiwix for
Apple](https://github.com/kiwix/apple) against a
Apple](https://github.com/kiwix/kiwix-apple) against a
pre-configured ZIM file.

This project contains data and scripts needed to create specific
Expand All @@ -23,15 +23,15 @@ that is lowercased and contains no space.

The configuration of the custom app is handled using the `info.json`
file which **is required to be placed in the custom app folder**. Take example on an already
existing one if you need to create a new custom app.
existing one if you need to create a new custom app.

### The required fields are:
- `about_app_url` - this is an external link that is placed in the "About section" of the application. (Eg. "https://www.dwds.de")
- `about_text` - this is a custom text that is placed in the "About section" describing what the application is about. It is not supporting html tags, but new lines can be added with '\n'.
- `app_name` - Name of the app, as it will appear on device, and in App Store
- `app_store_id` - this should to be taken from the developer.apple.com, where the application release is prepared. Note you can use the app_store_id even if the app is not yet released. The id is used within the app in the "Rate the app" section, so users can be redirected to a specific app in the App Store, to rate it.
- `enforced_lang` - ISO 639-1 language code (eg: en, de, he) if it is set, it will include only this language in the final app, meaning no other languages can be selected (on iOS) for the application UI. See the current list of supported languages [already translated in the main repo](https://github.com/kiwix/apple/tree/main/Support). When using this option, make sure that [the translation coverage](https://translatewiki.net/wiki/Special:MessageGroupStats/kiwix-apple?group=kiwix-apple&messages=&suppressempty=1&x=D) is 100% for the enforced language.
- `enforced_lang` - ISO 639-1 language code (eg: en, de, he) if it is set, it will include only this language in the final app, meaning no other languages can be selected (on iOS) for the application UI. See the current list of supported languages [already translated in the main repo](https://github.com/kiwix/kiwix-apple/tree/main/Support). When using this option, make sure that [the translation coverage](https://translatewiki.net/wiki/Special:MessageGroupStats/kiwix-apple?group=kiwix-apple&messages=&suppressempty=1&x=D) is 100% for the enforced language.

If enforced_lang is not added to the info.json file, all languages will be supported by the app, just like in Kiwix.

- `settings_default_external_link_to` - this controls how external links (pointing to content on the web, that are not included in the zimfile) should be treated. It can take one of the following values:
Expand Down Expand Up @@ -72,12 +72,12 @@ These are mostly images and json files underneath, so theoretically they could b

**In short: the app version is dictated by Github release tags.**

The release process ensures a systematic and clear versioning and releasing workflow for custom apps. You need to use GitHub release tags to trigger TestFlight uploads. The automated process guarantees compliance with [our versioning rules](https://github.com/kiwix/apple/issues/559) and [Apple's versioning guidelines](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring).
The release process ensures a systematic and clear versioning and releasing workflow for custom apps. You need to use GitHub release tags to trigger TestFlight uploads. The automated process guarantees compliance with [our versioning rules](https://github.com/kiwix/kiwix-apple/issues/559) and [Apple's versioning guidelines](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring).

The app version must be in the format: `YYYY.MM.build_version` [More on this process here](https://github.com/kiwix/apple/issues/559), this version will be visible in the App Store.
The app version must be in the format: `YYYY.MM.build_version` [More on this process here](https://github.com/kiwix/kiwix-apple/issues/559), this version will be visible in the App Store.

Each release is tied to a Github release tag. The tag can be defined when creating the release. The name of the tag is going to determine which app we want to release, and what the final version of that app will be.
The tag naming must follow the format:
The tag naming must follow the format:
`{brand_name}_YYYY.MM.{build_number}(_optional-part)`, eg: `dwds_2023.12.9` or `wikimed_2023.12.88_test`)

Where the:
Expand All @@ -92,4 +92,4 @@ License
-------

[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see
[LICENSE](LICENSE) for more details.
[LICENSE](LICENSE) for more details.

0 comments on commit 2212d6d

Please sign in to comment.