Skip to content

Commit

Permalink
Merge pull request spidernet-io#2397 from ty-dc/fix/workflows-1
Browse files Browse the repository at this point in the history
fix the problem that the rc version cannot generate artifact.
  • Loading branch information
weizhoublue authored Oct 11, 2023
2 parents ed69d2e + 36abf18 commit 90a4439
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 54 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/auto-version-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,13 @@ jobs:
uses: ./.github/workflows/call-release-chart.yaml
with:
ref: ${{ needs.get-tag.outputs.tag }}
# will submit on step update-github-pages
submit: false
secrets: inherit

release-doc:
needs: [build-release-image, get-tag]
uses: ./.github/workflows/call-release-doc.yaml
with:
ref: ${{ needs.get-tag.outputs.tag }}
# will submit on step update-github-pages
submit: false
secrets: inherit

update-github-pages:
needs: [release-doc, release-chart]
uses: ./.github/workflows/call-update-githubpages.yaml
with:
site_artifact_name: ${{ needs.release-doc.outputs.artifact }}
chart_artifact_name: ${{ needs.release-chart.outputs.artifact }}
secrets: inherit

release-changelog:
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/call-release-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ on:
ref:
required: true
type: string
submit:
required: true
type: string
outputs:
artifact:
description: "name of chart artifact"
value: chart_package_artifact
# value: ${{ jobs.example_job.outputs.output1 }}
workflow_dispatch:
inputs:
ref:
Expand All @@ -39,7 +31,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.get_original_ref.outputs.ref }}
submit: ${{ steps.get_original_ref.outputs.submit }}
steps:
- name: Get Original Ref
id: get_original_ref
Expand All @@ -48,12 +39,10 @@ jobs:
echo "call by workflow_call"
ver=${{ inputs.ref }}
echo ::set-output name=ref::${ver}
echo ::set-output name=submit::${{ inputs.submit }}
elif ${{ github.event_name == 'workflow_dispatch' }} ; then
echo "call by self workflow_dispatch"
ver=${{ github.event.inputs.ref }}
echo ::set-output name=ref::${ver}
echo ::set-output name=submit::true
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
Expand Down Expand Up @@ -101,7 +90,6 @@ jobs:
update_githubpage:
runs-on: ubuntu-latest
needs: [package_chart, get_ref]
if: ${{ needs.get_ref.outputs.submit == 'true' }}
steps:
- name: Get Base Chart URL
id: get_base_url
Expand All @@ -121,11 +109,10 @@ jobs:
uses: actions/download-artifact@v3
with:
name: chart_package_artifact
path: docs/charts/
path: charts/

- name: Update Chart Yaml
run: |
cd docs
helm repo index ./charts --url ${{ steps.get_base_url.outputs.url }}/charts
mv ./charts/index.yaml ./index.yaml
Expand Down
65 changes: 37 additions & 28 deletions .github/workflows/call-release-doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ on:
ref:
required: true
type: string
submit:
required: true
type: string
outputs:
artifact:
description: "name of artifact"
value: website_package_artifact
# --- call by manual
workflow_dispatch:
inputs:
Expand All @@ -26,14 +19,15 @@ permissions: write-all

env:
MERGE_BRANCH: github_pages
SRC_DIRECTORY: 'docs'
DEST_DIRECTORY: 'docs'
PR_LABEL: pr/release/robot_update_githubpage
PR_REVIWER: ty-dc

jobs:
release_doc:
runs-on: ubuntu-latest
outputs:
ref: ${{ env.REF }}
skip_all_job: ${{ env.SKIP_ALL_JOB }}
steps:
- name: Get Ref
id: get_ref
Expand All @@ -43,11 +37,9 @@ jobs:
if ${{ github.event_name == 'workflow_dispatch' }}; then
echo "call by workflow_dispatch"
echo "REF=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
echo "SUBMIT=true" >> $GITHUB_ENV
elif ${{ inputs.ref != '' }}; then
echo "call by workflow_call"
echo "REF=${{ inputs.ref }}" >> $GITHUB_ENV
echo "SUBMIT=${{ inputs.submit }}" >> $GITHUB_ENV
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
Expand Down Expand Up @@ -101,42 +93,59 @@ jobs:
cp ./docs/mkdocs.yml ./
if ${{ env.SET_LATEST == 'true' }} ;then
echo "generate doc version:${{ env.DOCS_TAG }} and set to latest."
mike deploy --rebase --prefix ${{ env.DEST_DIRECTORY }} -b ${{ env.MERGE_BRANCH }} --update-aliases ${{env.DOCS_TAG }} latest
mike set-default --prefix ${{ env.DEST_DIRECTORY }} -b ${{ env.MERGE_BRANCH }} latest
mike deploy --rebase -b ${{ env.MERGE_BRANCH }} --update-aliases ${{env.DOCS_TAG }} latest
mike set-default -b ${{ env.MERGE_BRANCH }} latest
else
echo "the version:${{ env.DOCS_TAG }} of the doc does not need to be set to the latest."
mike deploy --rebase --prefix ${{ env.DEST_DIRECTORY }} -b ${{ env.MERGE_BRANCH }} ${{ env.DOCS_TAG }}
mike deploy --rebase -b ${{ env.MERGE_BRANCH }} ${{ env.DOCS_TAG }}
fi
rm -rf ./site
rm -rf ./mkdocs.yml
git checkout -f ${{ env.MERGE_BRANCH }}
if ${{ env.SUBMIT != 'true' }}; then
cd docs
rm -rf ./charts
rm -rf ./index.yaml
tar -czvf ./site.tar.gz *
ls
echo "Automatic release, offline package ready"
fi
git checkout -f ${{ env.MERGE_BRANCH }}
rm -rf ./charts && rm -rf ./index.yaml && rm -rf ./changelogs
tar -czvf ./site.tar.gz *
ls
echo "Automatic release, offline package ready"
echo "Push a doc version: ${{ env.DOCS_TAG }} from branch: ${{ env.REF }}, update it to latest: ${{ env.SET_LATEST }} "
- name: Upload Artifact
uses: actions/[email protected]
if: ${{ env.SUBMIT != 'true' && env.SKIP_ALL_JOB != 'true' }}
if: ${{ env.SKIP_ALL_JOB != 'true' }}
with:
name: website_package_artifact
path: docs/site.tar.gz
path: site.tar.gz
retention-days: 0
if-no-files-found: error

create_pr:
name: Create PR
needs: [release_doc]
if: ${{ needs.release_doc.outputs.skip_all_job != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ env.MERGE_BRANCH }}
fetch-depth: 0

- name: Download Artifact
uses: actions/[email protected]
with:
name: website_package_artifact

- name: Untar Doc
run: |
tar -xzvf site.tar.gz
rm -f site.tar.gz
# Allow auto-merge on general
- name: Create Pull Request
id: create_pr
if: ${{ env.SUBMIT == 'true' && env.SKIP_ALL_JOB != 'true' }}
uses: peter-evans/[email protected]
with:
title: "robot update website from ${{ env.REF }} to branch ${{ env.MERGE_BRANCH }} "
commit-message: "robot update website from ${{ env.REF }} to branch ${{ env.MERGE_BRANCH }} "
title: "robot update website from ${{ needs.release_doc.outputs.ref }} to branch ${{ env.MERGE_BRANCH }} "
commit-message: "robot update website from ${{ needs.release_doc.outputs.ref }} to branch ${{ env.MERGE_BRANCH }} "
branch-suffix: timestamp
branch: robot/update_doc
delete-branch: true
Expand Down

0 comments on commit 90a4439

Please sign in to comment.