OSS Upload #2
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: OSS Upload | |
on: | |
workflow_dispatch: ## on button click | |
#workflow_run: | |
# workflows: ["Release Charts"] | |
# types: [completed] | |
# branches: | |
# - stable | |
#push: | |
# branches: | |
# - gh-pages | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Upload to OSS | |
if: ${{ vars.OSS_MIRROR_ENABLED == 'true' }} | |
shell: bash | |
env: | |
DL_URL_OSS: "https://gosspublic.alicdn.com/ossutil/1.7.1/ossutil64" | |
OSS_KEY_ID: "${{ secrets.OSS_KEY_ID }}" | |
OSS_KEY_SECRET: "${{ secrets.OSS_KEY_SECRET }}" | |
OSS_EP: "${{ vars.OSS_EP }}" | |
OSS_BUCKET: "${{ vars.OSS_BUCKET }}" | |
CHART_INDEX_URL: "${{ vars.CHART_INDEX_URL }}" | |
MIRROR_HOST: "${{ vars.MIRROR_HOST }}" | |
run: | | |
export ALIOSS="${HOME}/bin/ossutil" | |
mkdir -p $(dirname $ALIOSS) | |
curl -o $ALIOSS -L $DL_URL_OSS | |
chmod a+rx $ALIOSS | |
$ALIOSS config -e $OSS_EP -i $OSS_KEY_ID -k $OSS_KEY_SECRET | |
git branch -a | |
git show remotes/origin/gh-pages:index.yaml > /tmp/index.yaml | |
head -n50 /tmp/index.yaml | |
if head -n50 /tmp/index.yaml | grep -E '^apiVersion:' ; then | |
sed -i 's%- https://github\.com/%- https://'${MIRROR_HOST}'/github/%g' /tmp/index.yaml | |
$ALIOSS cp -f /tmp/index.yaml \ | |
"oss://${OSS_BUCKET}/kafka/index.yaml" \ | |
--meta "content-type:text/plain; charset=utf-8" | |
fi | |
$ALIOSS cp -rf ./examples/ "oss://${OSS_BUCKET}/kafka/examples/" |