Skip to content

Commit

Permalink
Documented authentication to GitHub Packages (#302)
Browse files Browse the repository at this point in the history
To download the artifact.
  • Loading branch information
freemanjp committed Apr 5, 2021
1 parent 8eadcdb commit f8718a5
Showing 1 changed file with 39 additions and 1 deletion.
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

0 comments on commit f8718a5

Please sign in to comment.