Skip to content

Commit

Permalink
Nnnnnnnnn (#1)
Browse files Browse the repository at this point in the history
* Create JarfileHashMojo.java

Signed-off-by: AdamKorcz <[email protected]>

* Create pom.xml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Delete JarfileHashMojo.java

Signed-off-by: AdamKorcz <[email protected]>

* Delete pom.xml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update README.md

Signed-off-by: AdamKorcz <[email protected]>

* Update action.yml

Signed-off-by: AdamKorcz <[email protected]>

* Update README.md

Signed-off-by: AdamKorcz <[email protected]>

* Update README.md

Signed-off-by: AdamKorcz <[email protected]>

---------

Signed-off-by: AdamKorcz <[email protected]>
  • Loading branch information
AdamKorcz authored Jul 28, 2023
1 parent 33edab4 commit cdc7088
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
19 changes: 8 additions & 11 deletions actions/maven/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ inputs:
type: string
provenance-download-sha256:
description: "The sha256 of the package provenance artifact."
required: false
required: true
type: string
target-download-sha256:
description: "The sha256 of the target directory."
required: true
type: string
maven-username:
description: "Maven username"
required: false
required: true
maven-password:
description: "Maven password"
required: false
required: true
gpg-key-pass:
description: "gpg-key-pass"
required: false
required: true
gpg-private-key:
description: "gpg-key-pass"
required: false
required: true
runs:
using: "composite"
steps:
- name: Checkout the project repository
uses: slsa-framework/slsa-github-generator/.github/actions/secure-project-checkout@main
uses: slsa-framework/slsa-github-generator/.github/actions/secure-project-checkout@main # needed because we run javadoc and sources.
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3
env:
Expand Down Expand Up @@ -81,9 +81,6 @@ runs:
SLSA_DIR: "${{ inputs.provenance-download-name }}"
PROVENANCE_FILES: "${{ inputs.provenance-download-name }}"
run: |
# Build and run custom plugin
cd plugin && mvn clean install && cd ..
# Re-indexing the secondary jar files for deploy
mvn javadoc:jar source:jar
# Retrieve project version
version=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout)
Expand All @@ -97,7 +94,7 @@ runs:
for name in $(find ./ -name "$artifactid-$version-*.jar")
do
# shellcheck disable=SC1001 # shellcheck complains over \- but the line does what it should.
target=$(echo "${name}" | rev | cut -d\- -f1 | rev)
target=$(echo "${name}" | rev | cut -d- -f1 | rev)
files=$files,$name
types=$types,${target##*.}
classifiers=$classifiers,${target%.*}
Expand All @@ -108,7 +105,7 @@ runs:
for name in $(find ./ -name "$artifactid-$version-*.jar.intoto.build.slsa")
do
# shellcheck disable=SC1001 # shellcheck complains over \- but the line does what it should.
target=$(echo "${name}" | rev | cut -d\- -f1 | rev)
target=$(echo "${name}" | rev | cut -d- -f1 | rev)
files=$files,$name
types=$types",slsa"
classifiers=$classifiers,${target::-9}
Expand Down
24 changes: 24 additions & 0 deletions internal/builders/maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ jobs:
Now, when you invoke this workflow, the Maven builder will build both your artifacts and the provenance files for them.
### Releasing directly to Maven Central
You can also release artifacts to Maven Central with [the slsa-github-generator Maven publisher](https://github.com/slsa-framework/slsa-github-generator/blob/main/actions/maven/publish/action.yml) by adding the following step to your workflow:
```yaml
Expand All @@ -107,6 +109,28 @@ Now your workflow will build your artifacts and publish them to a staging reposi
In the above example of the publish Action, the job that invokes the Maven builder is called `build`. The publish Action uses output from that job.

#### Publisher requirements

Besides adding the above workflow to your CI pipeline, you also need to add the following plugin to your `pom.xml`:

```java
<plugin>
<groupId>io.github.adamkorcz</groupId>
<artifactId>slsa-hashing-plugin</artifactId>
<version>0.0.1</version>
<executions>
<execution>
<goals>
<goal>hash-jarfile</goal>
</goals>
</execution>
</executions>
<configuration>
<outputJsonPath>${SLSA_OUTPUTS_ARTIFACTS_FILE}</outputJsonPath>
</configuration>
</plugin>
```

### Private Repositories

The builder records all provenance signatures in the [Rekor](https://github.com/sigstore/rekor) public transparency log. This record includes the repository name. To acknowledge you're aware that your repository name will be public, set the flag `rekor-log-public: true` when calling the builder:
Expand Down

0 comments on commit cdc7088

Please sign in to comment.