Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhoublue committed Jul 17, 2024
1 parent af1b510 commit 406eec3
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 145 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ChartOfed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Chart OFED

env:
CHART_PATH: ofed-driver/chart

on:
workflow_dispatch:
inputs:
ref:
description: 'tag, sha, branch'
required: true
default: main
push:
tags:
- ofed-driver-v[0-9]+.[0-9]+.[0-9]+

permissions: write-all

jobs:
get_info:
runs-on: ubuntu-latest
outputs:
chart_path: ${{ env.chart_path }}
code_sha: ${{ env.code_sha }}
steps:
- name: Get information
id: get_original_ref
run: |
echo '${{ toJSON(github) }}'
if ${{ github.event_name == 'workflow_dispatch' }}; then
echo "call by workflow_dispatch"
echo "code_sha=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
echo "chart_path=${{ env.CHART_PATH }}" >> $GITHUB_ENV
elif ${{ github.event_name == 'push' }} ; then
echo "call by push tag"
echo "code_sha=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "chart_path=${{ env.CHART_PATH }}" >> $GITHUB_ENV
else
exit 1
fi
call-workflow:
needs: [get_info]
uses: ./.github/workflows/callBuildImage.yaml
with:
code_sha: ${{ needs.get_info.outputs.code_sha }}
chart_path: ${{ needs.get_info.outputs.chart_path }}
secrets: inherit
145 changes: 0 additions & 145 deletions .github/workflows/buildImageRdmaTools.yaml

This file was deleted.

115 changes: 115 additions & 0 deletions .github/workflows/callBuildChart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Call Build Chart

env:
PR_LABEL: pr/release/robot_update_githubpage
PR_REVIWER: weizhoublue
MERGE_BRANCH: github_pages

on:
workflow_call:
inputs:
chart_path:
required: true
type: string
code_sha:
required: true
type: string

permissions: write-all

jobs:
package_chart:
runs-on: ubuntu-latest
outputs:
code_sha: ${{ env.code_sha }}
steps:
- name: Get information
run: |
echo '${{ toJSON(github) }}'
if ${{ inputs.ref != '' }}; then
echo "code_sha=${{ inputs.code_sha }}" >> $GITHUB_ENV
echo "chart_path=${{ inputs.chart_path }}" >> $GITHUB_ENV
else
eixt 1
fi
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ env.code_sha }}

- name: Install Helm
uses: azure/setup-helm@v4
#with:
# version: ${{ env.HELM_VERSION }}

- name: Package Chart
continue-on-error: false
run: |
helm package ${{ env.chart_path }}
if ! ls *.tgz &>/dev/null ; then
echo "failed to generate chart"
exit 1
fi
mkdir -p tmp
mv *.tgz tmp
- name: Upload Artifact
uses: actions/[email protected]
with:
name: chart_package_artifact
path: tmp/*
retention-days: 1
if-no-files-found: error

# update /index.yaml in the target branch
update_githubpage:
runs-on: ubuntu-latest
needs: [package_chart]
steps:
- name: Get Base Chart URL
id: get_base_url
run: |
name=${{ github.repository }}
proj=${name#*/}
url=https://${{ github.repository_owner }}.github.io/${proj}
echo "URL=${url}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ env.MERGE_BRANCH }}
persist-credentials: "true"

- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: chart_package_artifact
path: charts/

- name: Update Chart Yaml
run: |
helm repo index ./charts --url ${{ env.URL }}/charts
mv ./charts/index.yaml ./index.yaml
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Create Pull Request
uses: peter-evans/[email protected]
with:
title: "robot Update chart from ${{ needs.get_ref.outputs.code_sha }} to branch ${{ env.MERGE_BRANCH }} "
commit-message: "robot Update chart from ${{ needs.get_ref.outputs.code_sha }} to branch ${{ env.MERGE_BRANCH }} "
branch-suffix: timestamp
branch: robot/update_chart
committer: ty-dc <[email protected]>
delete-branch: true
base: ${{ env.MERGE_BRANCH }}
signoff: true
token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ env.PR_LABEL }}
reviewers: ${{ env.PR_REVIWER }}

0 comments on commit 406eec3

Please sign in to comment.