Third-party mirror #43
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: Third-party mirror | |
on: | |
workflow_dispatch: | |
inputs: | |
url: | |
description: "url to download" | |
required: true | |
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 }} | |
OSS_PATH_PREFIX: "oss://oneflow-static/third_party_mirror/https" | |
run: | | |
set -x | |
URL="${{ github.event.inputs.url }}" | |
[[ "${URL}" =~ ^https:// ]] && echo ok || { echo "url must starts with 'https://'"; exit 1; } | |
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 | |
URL_NOPRO=${URL:7} | |
URL_REL=${URL_NOPRO#*/} | |
PATH_NAME="${URL_REL%%\?*}" | |
wget ${{ github.event.inputs.url }} | |
filename=$(basename "${{ github.event.inputs.url }}") | |
md5=$(md5sum "$filename" | awk '{print $1}') | |
echo "::warning file=${filename},line=0,col=0,endColumn=0::${md5}" | |
ossutil64 --update cp ${filename} ${{ env.OSS_PATH_PREFIX }}/${PATH_NAME} |