Download anything #36
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
name: Download anything | |
on: | |
workflow_dispatch: | |
inputs: | |
url: | |
description: "url to download" | |
required: true | |
ossPath: | |
default: "oss://oneflow-static/downloads" | |
required: false | |
description: "path to put file" | |
filename: | |
default: "" | |
required: false | |
description: "rename file" | |
jobs: | |
download: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- env: | |
OSS_ACCESS_KEY_ID: ${{ secrets.OSS_ACCESS_KEY_ID }} | |
OSS_ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }} | |
run: | | |
set -x | |
mkdir -p $HOME/bin | |
curl http://gosspublic.alicdn.com/ossutil/1.6.19/ossutil64 -o $HOME/bin/ossutil64 | |
chmod 755 $HOME/bin/ossutil64 | |
export PATH=$PATH:$HOME/bin | |
ossutil64 config -e oss-cn-beijing.aliyuncs.com -i ${OSS_ACCESS_KEY_ID} -k ${OSS_ACCESS_KEY_SECRET} -L EN -c $HOME/.ossutilconfig | |
filename=$(basename "${{ github.event.inputs.url }}") | |
filename_input=${{ github.event.inputs.filename }} | |
if [[ -z "$filename_input" ]]; then | |
echo "using filename from url: ${filename}" | |
else | |
filename="${filename_input}" | |
echo "setting filename: ${filename}" | |
fi | |
wget ${{ github.event.inputs.url }} -O ${filename} | |
ossutil64 --update cp "${filename}" "${{ github.event.inputs.ossPath }}/${filename}" |