Skip to content

Development Guide

Endi S. Dewata edited this page Jul 8, 2024 · 5 revisions

Creating Repository Token

Create a classic token with the following properties:

  • Expiration: No expiration

  • Scopes:

    • repo

      • public_repo

    • user

      • user:email

Configuring Secret

Store the token into a secret called REPO_TOKEN in the project.

Configuring settings.xml

Update settings.xml to use the REPO_TOKEN:

$ xmlstarlet edit \
    --inplace \
    -u "/_:settings/_:servers/_:server/_:password" -v "$REPO_TOKEN" \
    ~/.m2/settings.xml

Configuring pom.xml

Update pom.xml to deploy the artifacts into the maven branch:

<plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>3.1.2</version>
    <configuration>
        <altDeploymentRepository>local::file://${project.build.directory}/repo</altDeploymentRepository>
    </configuration>
</plugin>
<plugin>
    <groupId>com.github.github</groupId>
    <artifactId>site-maven-plugin</artifactId>
    <version>0.12</version>
    <configuration>
        <message>Deploy ${project.groupId}:${project.artifactId}:${project.version}</message>
        <noJekyll>true</noJekyll>
        <outputDirectory>${project.build.directory}/repo</outputDirectory>
        <includes>
            <include>**/*</include>
        </includes>
        <repositoryOwner>dogtagpki</repositoryOwner>
        <repositoryName>repo</repositoryName>
        <branch>refs/heads/maven</branch>
        <merge>true</merge>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>site</goal>
            </goals>
            <phase>deploy</phase>
        </execution>
    </executions>
</plugin>

Deploying Maven Artifacts

To deploy the artifacts:

$ mvn \
    --batch-mode \
    --update-snapshots \
    deploy

Publish Maven Artifacts (Not Yet Implemented)

$ curl \
    -X POST \
    -H "Authorization: token $REPO_TOKEN" \
    -H "Accept: application/vnd.github.everest-preview+json" \
    -d '{"event_type": "publish"}' \
    https://api.github.com/repos/dogtagpki/repo/dispatches