-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (48 loc) · 1.62 KB
/
oss-upload.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: OSS Upload
on:
workflow_dispatch: ## on button click
workflow_run:
workflows: ["Release Charts"]
types: [completed]
branches:
- main
#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/"