Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented authentication to GitHub Packages #302

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

Maven plugin metadata extractor for plugins written in Kotlin.

**Note:** this JAR isn't available from Maven Central, see below for how to
configure a `pluginRepository` to download the JAR from GitHub Packages.

**This project is still a little new, so please help by reporting any issues you find.**

## Maven plugin support for Kotlin
Expand Down Expand Up @@ -204,7 +207,8 @@ Your POM will include the following:
-->
<pluginRepositories>
<pluginRepository>
<id>kotlin-maven-plugin-tools</id>
<!-- id must match the id of the server in settings.xml -->
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/gantsign/kotlin-maven-plugin-tools</url>
<snapshots>
Expand All @@ -216,6 +220,40 @@ Your POM will include the following:
</project>
```

GitHub Packages repositories require authentication, so you need to specify the
credentials in your `settings.xml`. You don't need particular permissions, any
valid GitHub account token will do.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<!-- This is setup for you if using id "github" with
https://github.com/actions/setup-java -->
<!-- id must match the id of the pluginRepository -->
<id>github</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>

</settings>
```

If using GitHub Actions, you also need to pass the `GITHUB_TOKEN` environment
variable to the build step(s) in your workflow file e.g.:

```yaml
- name: Build with Maven
run: mvn install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

License
-------

Expand Down