Skip to content

Commit f59ab00

Browse files
committed
docs(check): Ensure a good documentation for new arrivals on the project
1 parent 63bb524 commit f59ab00

File tree

1 file changed

+56
-86
lines changed

1 file changed

+56
-86
lines changed

README.md

Lines changed: 56 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
This is an Android implementation of the Xpeho UI made with Jetpack Compose.
44

5-
## Getting started
5+
## Import the package
66

7-
### Changes on the library
7+
To import the package in your android project, follow theses steps:
88

9-
- Clone the repository using `git clone`
10-
- Launch the folder in Android Studio
11-
- Make your changes
12-
- Send a Pull Request
13-
14-
### Import and use the library in your app
15-
16-
- Add the following code to your gradle repositories _(pluginManagement and dependencyREsolutionManagement blocks)_ :
9+
- Add the following code to your gradle file on your project _(pluginManagement and dependencyREsolutionManagement blocks)_ :
1710

1811
```gradle
1912
maven {
@@ -25,40 +18,48 @@ This is an Android implementation of the Xpeho UI made with Jetpack Compose.
2518
}
2619
```
2720

28-
- As you can see we don't set username and password, that's because we can't compute from a `github.properties` file in that type of block so we add the following code after these two blocks :
21+
- As you can see we don't set username and password, that's because we can't compute from an other file in that type of block so we add the following code after these two blocks :
2922

3023
```gradle
31-
// Load properties from github.properties file
32-
def githubProperties = new Properties()
33-
file('github.properties').withInputStream { stream ->
34-
githubProperties.load(stream)
35-
}
36-
3724
// Update credentials
3825
gradle.settingsEvaluated {
39-
pluginManagement.repositories {
40-
maven {
41-
url 'https://maven.pkg.github.com/XPEHO/xpeho_ui_android'
42-
credentials {
43-
username = githubProperties['gpr.user'] ?: ""
44-
password = githubProperties['gpr.key'] ?: ""
45-
}
46-
}
47-
}
48-
49-
dependencyResolutionManagement.repositories {
50-
maven {
51-
url 'https://maven.pkg.github.com/XPEHO/xpeho_ui_android'
52-
credentials {
53-
username = githubProperties['gpr.user'] ?: ""
54-
password = githubProperties['gpr.key'] ?: ""
55-
}
56-
}
57-
}
26+
pluginManagement.repositories {
27+
maven {
28+
url 'https://maven.pkg.github.com/XPEHO/xpeho_ui_android'
29+
credentials {
30+
username = System.getenv('GITHUB_USER') ?: ""
31+
password = System.getenv('GITHUB_TOKEN') ?: ""
32+
}
33+
}
34+
}
35+
36+
dependencyResolutionManagement.repositories {
37+
maven {
38+
url 'https://maven.pkg.github.com/XPEHO/xpeho_ui_android'
39+
credentials {
40+
username = System.getenv('GITHUB_USER') ?: ""
41+
password = System.getenv('GITHUB_TOKEN') ?: ""
42+
}
43+
}
44+
}
5845
}
5946
```
6047

61-
- For the creation of the `github.properties` refer to the linked section in the **Deployment** part.
48+
- Add the needed environment variables :
49+
50+
- On a mac/linux you can add them to your `.zshrc`/`.bashrc`
51+
52+
```zshrc
53+
#Github
54+
export GITHUB_USER="your_github_username"
55+
export GITHUB_TOKEN="your_github_token"
56+
```
57+
58+
To fill the GITHUB_TOKEN, make sure to generate a PAT (Personal Access Token) on your github account following the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).
59+
60+
You need to allow the following rights :
61+
![repos_right](doc/repos_right.png)
62+
![packages_right](doc/packages_right.png)
6263
6364
- Now we can add in our **dependencies** block of the `build.gradle` file the following implementation :
6465
@@ -73,54 +74,7 @@ This is an Android implementation of the Xpeho UI made with Jetpack Compose.
7374
import com.xpeho.xpeho_ui_android.*
7475
```
7576

76-
## Deployment
77-
78-
### Java Runtime
79-
80-
Make sure you have install a Java Runtime.
81-
82-
- MacOS :
83-
```shell
84-
brew install java
85-
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc
86-
export CPPFLAGS="-I/usr/local/opt/openjdk/include"
87-
```
88-
89-
After that you can relaunch your terminale or type :
90-
```shell
91-
source ~/.zshrc
92-
```
93-
94-
### Github properties
95-
96-
Define at the root of the repository a file `github.properties` following this structure :
97-
98-
```
99-
gpr.user=YOUR_USERNAME
100-
gpr.key=YOUR_PERSONAL_ACCESS_TOKEN
101-
```
102-
103-
Make sure to generate a PAT (Personal Access Token) on your github account following the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).
104-
105-
You need to allow the following rights :
106-
![repos_right](doc/repos_right.png)
107-
![packages_right](doc/packages_right.png)
108-
109-
> [!WARNING]
110-
> Make sure to have the right access to the repository to be able to deploy.
111-
112-
### Process
113-
114-
Make sure to update the version code in the [build.gradle.kts](xpeho_ui_android/build.gradle.kts) file, it will be the version code of the package on github.
115-
116-
Now launch a terminal in the root of the directory and type :
117-
118-
- `./gradlew assembleRelease`
119-
- `./gradlew publish`
120-
121-
You can check the deployment by looking at the repository page, it should have your deployment on the packages section.
122-
123-
## Usage
77+
## Use the package
12478

12579
### Assets
12680

@@ -292,6 +246,7 @@ ChoiceSelector(
292246
![FilePreviewButton](xpeho_ui_android/doc/filepreviewbutton.png)
293247

294248
Usage:
249+
295250
```kotlin
296251
import com.xpeho.xpeho_ui_android.FilePreviewButton
297252

@@ -309,9 +264,24 @@ FilePreviewButton(
309264
onPress: () -> Unit,
310265
arrowIcon: @Composable() -> Unit,
311266
)
267+
```
268+
269+
## Edit the package
270+
271+
- Clone the repository using `git clone`
272+
- Launch the folder in Android Studio
273+
- Make your changes
274+
- Send a Pull Request
275+
276+
## Deploy the package
277+
278+
A workflow has been created on this repository to automatically deploy the package in artifacts on creating a new release.
279+
280+
The only thing you need to do so is to create a new release on the repository following the [GitHub documentation](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).
312281

282+
You can check the deployed packages by looking at the repository page, it should have your packages on the packages section.
313283

314-
## Testing
284+
## Testing the package
315285

316286
### Snapshot testing
317287

0 commit comments

Comments
 (0)