Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
xucian committed Nov 10, 2021
1 parent 7e5fff1 commit 0e9c248
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ inputs:
required: true
bucket:
description: |
"Leave empty to use the implicit 'gh-runs_<org-name>_<repo-name>'.
Note that the bucket must already exist, and names can be up to 63 chars (as per GCS documentation).
For the implicit bucket name, dots are replaced by hyphens, slashes are replaced by underscores. The bucket name should be lowercase. For 'My-Dear-Org/my.repo', we get 'gh-runs_my-dear-org_my-repo'"
"Specify bucket name or leave empty to use the one generated by main-quest/actions.gsutil.artifact.bucketname"
required: false
name:
description: "Artifact name. Artifacts are stored in folders under <bucket>/run-<run-id>/<artifact-name>/"
required: true
path:
description: "Source file/dir."
description: "Source file/dir"
required: true
zip:
description: "Upload a single zip file with all the files at 'path'"
Expand All @@ -25,26 +23,17 @@ runs:
using: "composite"
steps:
- name: Get bucket name
id: bucket_namer
shell: bash
run: |
b="${{ inputs.bucket }}"
if [ -z "$b" ]; then
repo="${{ github.repository }}"
b_no_slashes=$(echo "$repo" | sed "s/\//_/g")
b_no_dots=$(echo "$b_no_slashes" | sed "s/\./-/g")
b_lowercase=$(echo "$b_no_dots" | (tr '[:upper:]' '[:lower:]'))
b=gh-runs_"$b_lowercase"
echo "Using $b as implicit bucket name"
fi
echo "::set-output name=value::$b"
id: namer
uses: main-quest/[email protected]
with:
bucket: ${{ inputs.bucket }}

- name: Upload raw
uses: main-quest/[email protected]
if: ${{ inputs.zip == 'false' }}
with:
key: ${{ inputs.key }}
do: -m cp -r "${{ inputs.path }}" "gs://${{ steps.bucket_namer.outputs.value }}/${{ github.run_id }}/${{ inputs.name }}/"
do: -m cp -r "${{ inputs.path }}" "gs://${{ steps.namer.outputs.bucket_name }}/${{ github.run_id }}/${{ inputs.name }}/"

- name: Zip files if asked to
id: zip_preparer
Expand All @@ -62,4 +51,4 @@ runs:
if: ${{ inputs.zip == 'true' }}
with:
key: ${{ inputs.key }}
do: -m cp -r "${{ steps.zip_preparer.outputs.file_path }}" "gs://${{ steps.bucket_namer.outputs.value }}/${{ github.run_id }}/${{ inputs.name }}/"
do: -m cp -r "${{ steps.zip_preparer.outputs.file_path }}" "gs://${{ steps.namer.outputs.bucket_name }}/${{ github.run_id }}/${{ inputs.name }}/"

0 comments on commit 0e9c248

Please sign in to comment.