Skip to content

Commit 1049515

Browse files
committed
docs: create & provide PAT as part of Quick Start
1 parent 969e89e commit 1049515

File tree

2 files changed

+100
-76
lines changed

2 files changed

+100
-76
lines changed

.github/template/README.md

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,38 @@ Automated migration completed, enjoy the template.
2020

2121
## Quick Start
2222
1. [Use this template](https://github.com/thriving-dev/java-library-template/generate) to create your own repository
23-
2. Manually trigger '**!! INITIAL: Migrate Repo Template !!**' action
24-
> ℹ️ This workflow automatically 'migrates' all files in your new repository, updating the **gradle project group**, **module name**, **package names**, and **all references** to the repo `<owner>/<name>`.
25-
>
26-
> - Head over to **Actions** (1)
27-
> - on the left-hand side select the topmost workflow '**!! INITIAL: Migrate Repo Template !!**' (2)
28-
> - click the **Run workflow** button (3)
29-
> - **fill out** the form & **start** the pipeline (4)(5)
30-
> ___
31-
> ![image](https://github.com/thriving-dev/java-library-template/assets/10864443/41a380d5-e521-4050-9296-9f5bee4088e6)
32-
33-
3. One-off tasks
23+
2. Create & provide a PAT (Personal Access Token) for the CI/CD pipeline
24+
25+
Three workflows commit and push changes to the repository and therefore require additional permissions. ('migrate-repo-template', 'publish-javadoc', 'gradle-release')
26+
27+
The jobs expect a secret by the name `CI_GITHUB_TOKEN` that holds a PAT with _write_ permission for _Content_.
28+
29+
To create a new access token, the following steps are required (ref [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)):
30+
1. If the new repo owner is an organisation, **enrol** the organisation for '**Fine-grained personal access tokens**'. In the organisation ['Settings > Third-party Access > Personal access tokens'](https://github.com/organizations/%REPO_OWNER%/settings/personal-access-tokens).
31+
2. Head to the [Developer settings](https://github.com/settings/tokens?type=beta) and **enrol** your personal account for the new '**Fine-grained personal access tokens**'. (That's a one-off for your account and you might already have done this before)
32+
3. Next, click on the button '**Generate new token**' and create a token for the target _**Resource owner**_, with access to your project and the following '**Repository Permissions**'
33+
* **Contents:** **Read** and **Write** access to code
34+
* **Metadata:** **Read** access to metadata
35+
36+
<img width="680" alt="image" src="https://github.com/thriving-dev/java-library-template/assets/10864443/ff00fec5-36b5-46b3-9fae-83504aa00199">
37+
38+
39+
Provide your new PAT either as an Organisation secret or a Repository secret with the name `CI_GITHUB_TOKEN`.
40+
41+
<img width="800" src="https://github.com/thriving-dev/java-library-template/assets/10864443/9a9224ef-ef58-4c59-9025-5d83ac5981b9">
42+
43+
3. Trigger the '**!! INITIAL: Migrate Repo Template !!**' workflow
44+
45+
ℹ️ This workflow automatically 'migrates' all files in your new repository, updating the **gradle project group**, **module name**, **package names**, and **all references** to the repo `<owner>/<name>`.
46+
47+
- Head over to **Actions** (1)
48+
- on the left-hand side select the topmost workflow '**!! INITIAL: Migrate Repo Template !!**' (2)
49+
- click the **Run workflow** button (3)
50+
- **fill out** the form & **start** the pipeline (4)(5)
51+
52+
![image](https://github.com/thriving-dev/java-library-template/assets/10864443/41a380d5-e521-4050-9296-9f5bee4088e6)
53+
54+
4. Final one-off tasks
3455
* Choose & update the LICENSE, [here](LICENSE)
3556
* Update _Maven Publication_ details [here](%ARTIFACT_NAME%/build.gradle.kts#L6-L13)
3657
* [Configure GitHub Pages](#prerequisites-configure-github-pages) to deploy branch 'gh-pages' (Javadoc)
@@ -39,19 +60,19 @@ Automated migration completed, enjoy the template.
3960
* Install & configure renovate app ([instructions](#prerequisites-enable--configure-renovate))
4061

4162
## Project Structure
42-
The project template consists of three top level _folders_:
43-
* `.github/`: Defines the Github Actions CI tasks and templates for new pull requests, issues, etc.
63+
The project template consists of three top-level _folders_:
64+
* `.github/`: Defines the GitHub Actions CI tasks and templates for new pull requests, issues, etc.
4465
* `gradle/`: Contains Gradle Configuration files such as the Gradle [Version Catalog](https://docs.gradle.org/current/userguide/platforms.html) and the Gradle Wrapper.
45-
* `%ARTIFACT_NAME%/`: The library source code (gradle sub-project).
66+
* `%ARTIFACT_NAME%/`: The library source code (Gradle sub-project).
4667

4768
In addition, following _files_ are worth highlighting:
4869
* `gradle/libs.versions.toml`: A [conventional file](https://docs.gradle.org/current/userguide/platforms.html#sub:conventional-dependencies-toml) to declare a version catalog.
49-
* `settings.gradle.kts`: The multi-project Gradle settings file. Here are all sub-projects defined.
70+
* `settings.gradle.kts`: The multi-project Gradle settings file. Here are all the sub-projects defined.
5071
* `gradle.properties`: Holds the library version, needed & maintained by the CI/CD pipeline [release process](#release-process).
5172
* `**/build.gradle.kts`: Gradle build file
5273

5374
## CI/CD Pipeline
54-
The heart of this template is the 'Main GitHub Actions CI/CD Pipeline'.
75+
The heart of this template is the ['Main GitHub Actions CI/CD Pipeline'](https://github.com/%REPO_OWNER%/%REPO_NAME%/actions/workflows/1.pipeline.yml).
5576

5677
![image](https://github.com/thriving-dev/java-library-template/assets/10864443/8e5436c3-f807-4617-9e77-6d21e9dfb7c2)
5778

@@ -61,14 +82,14 @@ Based on the context (trigger, ref, input arguments) it meets different use case
6182
Runs for active PRs - as well as part of all subsequent listed use cases.
6283
2. **Latest**. 'Check', publish SNAPSHOT version to Maven Central and Javadoc (GitHub Pages).
6384
Runs on pushes to the main branch.
64-
3. **Release Process**. 'Check', executes (major|minor|patch) release process via Gradle plugin.
85+
3. **Release Process**. 'Check', executes (major|minor|patch) release process via the Gradle plugin.
6586
Manually triggered workflow via GitHub UI/API.
6687
3. **Library Release**. 'Check', publish RELEASE version to Maven Central and Javadoc (GitHub Pages).
6788
Runs for pushed tags.
6889

6990
## Publish to Maven Central
7091
### Automated Process
71-
The maven publish process is fully automated and does not require manual action.
92+
The Maven publish process is fully automated and does not require manual action.
7293
- The _main_ branch (per process definition) always is set to the next [SNAPSHOT version](gradle.properties) and is published to the Sonatype snapshot repository with each main CI/CD pipeline run. The pipeline runs e.g. when a PR is merged, but can also be triggered manually.
7394
- Release deployment happens when a new tag is pushed to GitHub. (Part of the [release process](#release-process))
7495

@@ -80,8 +101,8 @@ In order to deploy your components to OSSRH with Gradle, you have to meet the [r
80101

81102
> ℹ️ The publish process uses [io.github.gradle-nexus.publish-plugin](https://plugins.gradle.org/plugin/io.github.gradle-nexus.publish-plugin) under the hood.
82103
83-
The gradle project as well as the CI/CD pipeline is already fully prepared for the publish process.
84-
The GH actions job [callable.publish-sonatype.yml](.github/workflows/callable.publish-sonatype.yml) requires following Secrets:
104+
The gradle project as well as the CI/CD pipeline is already fully prepared for the publishing process.
105+
The GH actions job [callable.publish-sonatype.yml](.github/workflows/callable.publish-sonatype.yml) requires the following Secrets:
85106

86107
| Secret name | Value |
87108
|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -95,7 +116,7 @@ Please define the secrets via your repository settings. ([Settings > Security >
95116

96117
## Release Process
97118
### Creating a Release
98-
To release a new version via the CI/CD Pipeline, please follow instructions below.
119+
To release a new version via the CI/CD Pipeline, please follow the instructions below.
99120
- Navigate to Actions (1)
100121
- \> Main Pipeline (2)
101122
- Click 'Run workflow' button (3)
@@ -116,16 +137,7 @@ The new version is automatically published to Maven Central! 🚀
116137
### Prerequisites: PAT provided as `CI_GITHUB_TOKEN`
117138
The CI/CD 'gradle-release' job expects a secret by the name `CI_GITHUB_TOKEN` that holds a PAT (Personal Access Token) with permission to push tags as part of the release process.
118139

119-
To create a new access token, please head over to the [Developer settings](/settings/tokens?type=beta) and enroll for the new 'Fine-grained personal access tokens'.
120-
Next, click on the button 'Generate new token' and create a token for the target _Resource owner_, with access to your project and the following 'Repository Permissions'
121-
* **Contents:** **Read** and **Write** access to code
122-
* **Metadata:** **Read** access to metadata
123-
124-
Please refer to the official [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).
125-
126-
Provide your new PAT either as an Organisation secret or Repository secret.
127-
128-
<img width="680" src="https://github.com/thriving-dev/java-library-template/assets/10864443/9a9224ef-ef58-4c59-9025-5d83ac5981b9">
140+
If you have been following the Quick Start guide you should already have this configured. Please refer to ['Quick Start' step 2](#quick-start).
129141

130142
## Javadoc
131143
### Use

0 commit comments

Comments
 (0)