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

feat: choose where to install witness #13

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ host your own instances.

| Name | Description | Required | Default |
| ------------------------ | ---------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
| enable-sigstore | Use Sigstore for attestation. Sets default values for fulcio, fulcio-oidc-client-id, fulcio-oidc-issuer, and timestamp-servers when true | No | true |
| witness-install-dir | Directory to install the witness tool into. The directory will attempted to be created if it does not exists | No | ./ |
| enable-sigstore | Use Sigstore for attestation. Sets default values for fulcio, fulcio-oidc-client-id, fulcio-oidc-issuer, and timestamp-servers when true | No | true |
| enable-archivista | Use Archivista to store or retrieve attestations | No | true | true |
| archivista-server | URL of the Archivista server to store or retrieve attestations | No | <https://archivista.testifysec.io> |
| archivista-server | URL of the Archivista server to store or retrieve attestations | No | <https://archivista.testifysec.io> |
| attestations | Attestations to record, space-separated | No | environment git github |
| certificate | Path to the signing key's certificate | No | |
| fulcio | Fulcio address to sign with | No | |
Expand Down
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const path = require("path");
const tc = require('@actions/tool-cache');

async function run() {
const witnessInstallDir = core.getInput('witness-install-dir') || './';
// Download Witness
const version = core.getInput("version");
const witnessExtractPath = './'

let witnessPath = tc.find('witness', version);
console.log('Cached Witness Path: ' + witnessPath);
Expand All @@ -30,7 +30,11 @@ async function run() {
witnessTar = await tc.downloadTool('https://github.com/in-toto/witness/releases/download/v' + version + '/witness_' + version + '_linux_amd64.tar.gz');
}

witnessPath = await tc.extractTar(witnessTar, witnessExtractPath);
if (!fs.existsSync(witnessInstallDir)) {
fs.mkdirSync(witnessInstallDir, { recursive: true });
}

witnessPath = await tc.extractTar(witnessTar, witnessInstallDir);
const cachedPath = await tc.cacheFile(witnessPath + 'witness', 'witness', 'witness', version);
console.log('Witness cached at: ' + cachedPath);
}
Expand Down