Skip to content

Commit

Permalink
Merge pull request zcash#6820 from zcash/CI
Browse files Browse the repository at this point in the history
CI Tekton Migration to Github Action
  • Loading branch information
str4d authored Mar 5, 2024
2 parents c791f0a + 08f115d commit 239edcf
Show file tree
Hide file tree
Showing 3 changed files with 501 additions and 50 deletions.
61 changes: 61 additions & 0 deletions .github/actions/gcs-download-cloud-storage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: 'gcs-download-cloud-storage'
description: 'Download files from a GCS bucket'
inputs:
path-prefix:
description: 'The bucket path inside which the source path is located'
required: true
source:
description: 'The path to the files to download'
required: true
destination:
description: 'The directory into which the files will be downloaded'
required: true
remove-first-if-exists:
description: 'Deletes the given path first (if it exists) before downloading files'

runs:
using: 'composite'
steps:
- name: Set up Cloud SDK
if: runner.os != 'Linux'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 390.0.0' # To use gsutil with google-github-actions/auth

# Use $RUNNER_TEMP instead of ${{ runner.temp }} to prevent the Bash used by Windows
# runners from treating backslashes in Windows paths as escape characters.
# https://github.com/orgs/community/discussions/25910
- name: Create temporary directory
shell: bash
run: |
rm -rf $RUNNER_TEMP/gcs-download
mkdir $RUNNER_TEMP/gcs-download
- name: Download source
shell: bash
run: >
gcloud storage
cp -r
gs://gh-zcash/${{ inputs.path-prefix }}/${{ inputs.source }}
$RUNNER_TEMP/gcs-download
- name: Remove the specified path if it exists
if: inputs.remove-first-if-exists != ''
shell: bash
run: rm -rf ${{ inputs.remove-first-if-exists }}

- name: Ensure the target directory exists
shell: bash
run: mkdir -p ${{ inputs.destination }}

- name: Move source to target [Unix]
if: runner.os != 'Windows'
shell: bash
run: mv ${{ runner.temp }}/gcs-download/* ${{ inputs.destination }}

# PowerShell's mv aliases to its Move-Item cmdlet which has glob support (unlike mv in
# Git Bash for whatever reason).
- name: Move source to target [Windows]
if: runner.os == 'Windows'
shell: pwsh
run: mv ${{ runner.temp }}/gcs-download/* ${{ inputs.destination }}
Loading

0 comments on commit 239edcf

Please sign in to comment.