Skip to content

Commit

Permalink
refactor(main): auto package for tag
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <cuisongliu@qq.com>
  • Loading branch information
cuisongliu committed Jul 8, 2023
1 parent c93e0bb commit 32dca24
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
repository_dispatch:
Expand Down Expand Up @@ -42,7 +38,11 @@ jobs:
destination: ./_site
- name: Helm package
run: |
bash helm.sh
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
bash helm.sh ${{ github.event.client_payload.ref }}
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
bash helm.sh
fi
sudo cp index.yaml _site/
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
Expand Down
16 changes: 11 additions & 5 deletions helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
# 仓库名称
repository="labring/endpoints-operator"

# 获取最新release的版本号
latest_release=$(curl -s "https://api.github.com/repos/$repository/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# 版本号参数
version=$1

if [[ -z "$version" ]]; then
# 获取最新release的版本号
version=$(curl -s "https://api.github.com/repos/$repository/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
fi

# 构建下载链接
download_url="https://github.com/$repository/releases/download/$latest_release/endpoints-operator-${latest_release#v}.tgz"
download_url="https://github.com/$repository/releases/download/$version/endpoints-operator-${version#v}.tgz"

# 下载最新release
# 下载指定版本的release
wget $download_url

helm repo index . --url https://github.com/$repository/releases/download/$latest_release
helm repo index . --url https://github.com/$repository/releases/download/$version

0 comments on commit 32dca24

Please sign in to comment.