-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'" | ||
|
@@ -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 | ||
|
@@ -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 }}/" |