Skip to content

Commit

Permalink
add ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
itboon committed Jun 8, 2023
1 parent 74a65d1 commit 7c10017
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release Charts

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
-
name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_RELEASE_NAME_TEMPLATE: "{{ .Name }}-chart-{{ .Version }}"
49 changes: 49 additions & 0 deletions .github/workflows/oss-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: OSS Upload

on:
workflow_run:
workflows: ["Release Charts"]
types: [completed]
branches:
- main
#push:
# branches:
# - gh-pages

jobs:
oss:
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 }}"
CHART_NAME: rocketmq
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}/${CHART_NAME}/index.yaml" \
--meta "content-type:text/plain; charset=utf-8"
fi

0 comments on commit 7c10017

Please sign in to comment.