Skip to content

Commit

Permalink
chore: restore actions
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Jan 30, 2024
1 parent e5a600c commit 4947af4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .github/actions/docker-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ runs:
const callerIdentity = await exec.getExecOutput('aws sts get-caller-identity');
const arn = JSON.parse(callerIdentity.stdout).Arn;
const prefix = `${arn.match(/\/(.+)-runner-role\//)[1]}/docker/cache/v0/docker/registry/v2/`;
const buckets = await exec.getExecOutput('aws s3api list-buckets');
const bucket = JSON.parse(buckets.stdout).Buckets[0].Name;
const name = process.env.INPUTS_NAME || process.env.GITHUB_REPOSITORY
return {
to: `type=s3,mode=max,prefix=${prefix},bucket=${bucket},region=us-east-1,name=${name}`,
from: `type=s3,prefix=${prefix},bucket=${bucket},region=us-east-1,name=${name}`,
to: `type=s3,mode=max,prefix=${prefix},bucket=tf-aws-gh-runner,region=us-east-1,name=${name}`,
from: `type=s3,prefix=${prefix},bucket=tf-aws-gh-runner,region=us-east-1,name=${name}`,
instance: instance.stdout
}
result-encoding: json
4 changes: 2 additions & 2 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ runs:
const callerIdentity = await exec.getExecOutput('aws sts get-caller-identity');
const arn = JSON.parse(callerIdentity.stdout).Arn;
const prefix = arn.match(/\/(.+)-runner-role\//)[1];
const buckets = await exec.getExecOutput('aws s3api list-buckets');
const bucket = JSON.parse(buckets.stdout).Buckets[0].Name;
const source = process.env.INPUTS_SOURCE;
const destination = process.env.INPUTS_DESTINATION || source;
const sourceFullPath = `${prefix}/${process.env.GITHUB_REPOSITORY}/${process.env.GITHUB_RUN_ID}/${process.env.GITHUB_RUN_ATTEMPT}/${source}`
const recursiveOption = source.endsWith('/') ? '--recursive' : '';
const bucket = 'tf-aws-gh-runner'
await exec.exec(`aws s3 cp s3://${bucket}/${sourceFullPath} ${destination} ${recursiveOption}`)
return destination
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ runs:
const callerIdentity = await exec.getExecOutput('aws sts get-caller-identity');
const arn = JSON.parse(callerIdentity.stdout).Arn;
const prefix = arn.match(/\/(.+)-runner-role\//)[1];
const buckets = await exec.getExecOutput('aws s3api list-buckets');
const bucket = JSON.parse(buckets.stdout).Buckets[0].Name;
const source = process.env.INPUTS_SOURCE;
const destination = process.env.INPUTS_DESTINATION || source;
Expand All @@ -38,6 +36,8 @@ runs:
const destinationFullPath = `${prefix}/${process.env.GITHUB_REPOSITORY}/${process.env.GITHUB_RUN_ID}/${process.env.GITHUB_RUN_ATTEMPT}/${destinationPath}`
const recursiveOption = fs.lstatSync(source).isDirectory() ? '--recursive' : '';
const bucket = 'tf-aws-gh-runner'
await exec.exec(`aws s3 cp ${source} s3://${bucket}/${destinationFullPath} ${recursiveOption} --acl public-read`)
return `https://${bucket}.s3.amazonaws.com/${destinationFullPath}`
Expand Down

0 comments on commit 4947af4

Please sign in to comment.