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: Add artifact repo configuration #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
| --------- | ------------ | ----------- | ------------------------------------------------------------------------------------------------------------ | -------- |
| `cache` | No | `true` | Whether to cache RPC responses or not. | bool |
| `version` | No | `nightly` | Version to install, e.g. `nightly` or `1.0.0`. **Note:** Foundry only has nightly builds for the time being. | string |
| `repository` | No | `https://github.com` | Artifact repository url prefix to download Foundry binaries from. It needs to be compliant with Github's path. | string |
| `repository-auth` | No | `""` | HTTP Authorization header for the above repository. Not required for Github. | string |

### RPC Caching

Expand Down
16 changes: 16 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ inputs:
This version number has to match a released version of Foundry.
The default value is `nightly`, which will pull the latest nightly build.
required: false
repository:
default: "https://github.com"
description: |
Artifact repository URL prefix.

Artifact repository from which to download the foundry artifact from.
The repo artifact path has to conform to the url format of github, like `${repository}/foundry-rs/foundry/releases/download/${version}/${fullFileName}`
The default value is `https://github.com`.
required: false
repository-auth:
default: ""
description: |
HTTP Authorization header for the above repository. Not required for Github.

Left empty by default.
required: false

runs:
using: "node16"
Expand Down
11 changes: 7 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68384,11 +68384,14 @@ async function main() {
try {
// Get version input
const version = core.getInput("version");
// Get artifact repository input
const repository = core.getInput("repository");
const repositoryAuth = core.getInput("repository-auth");

// Download the archive containing the binaries
const download = getDownloadObject(version);
const download = getDownloadObject(repository, version);
core.info(`Downloading Foundry '${version}' from: ${download.url}`);
const pathToArchive = await toolCache.downloadTool(download.url);
const pathToArchive = await toolCache.downloadTool(download.url, '', repositoryAuth);

// Extract the archive onto host runner
core.debug(`Extracting ${pathToArchive}`);
Expand Down Expand Up @@ -68437,11 +68440,11 @@ function mapArch(arch) {
return mappings[arch] || arch;
}

function getDownloadObject(version) {
function getDownloadObject(repository, version) {
const platform = os.platform();
const filename = `foundry_${normalizeVersionName(version)}_${platform}_${mapArch(os.arch())}`;
const extension = platform === "win32" ? "zip" : "tar.gz";
const url = `https://github.com/foundry-rs/foundry/releases/download/${version}/${filename}.${extension}`;
const url = `${repository}/foundry-rs/foundry/releases/download/${version}/${filename}.${extension}`;

return {
url,
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ async function main() {
try {
// Get version input
const version = core.getInput("version");
// Get artifact repository input
const repository = core.getInput("repository");
const repositoryAuth = core.getInput("repository-auth");

// Download the archive containing the binaries
const download = getDownloadObject(version);
const download = getDownloadObject(repository, version);
core.info(`Downloading Foundry '${version}' from: ${download.url}`);
const pathToArchive = await toolCache.downloadTool(download.url);
const pathToArchive = await toolCache.downloadTool(download.url, '', repositoryAuth);

// Extract the archive onto host runner
core.debug(`Extracting ${pathToArchive}`);
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ function mapArch(arch) {
return mappings[arch] || arch;
}

function getDownloadObject(version) {
function getDownloadObject(repository, version) {
const platform = os.platform();
const filename = `foundry_${normalizeVersionName(version)}_${platform}_${mapArch(os.arch())}`;
const extension = platform === "win32" ? "zip" : "tar.gz";
const url = `https://github.com/foundry-rs/foundry/releases/download/${version}/${filename}.${extension}`;
const url = `${repository}/foundry-rs/foundry/releases/download/${version}/${filename}.${extension}`;

return {
url,
Expand Down