Skip to content

Commit

Permalink
Merge pull request #4906 from himeshsiriwardana/build-script-update
Browse files Browse the repository at this point in the history
modified build script to release 2 assets
  • Loading branch information
himeshsiriwardana authored Dec 3, 2024
2 parents e582c8e + e1eb25c commit a537b12
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,35 @@ jobs:

- name: Build MkDocs Documentation
run: |
unset ENABLE_HOOKS
cd en/asgardeo
mkdocs build
cd ../../
- name: Conditionally build MkDocs Documentation
run: |
export ENABLE_HOOKS=true
cd en/asgardeo
mkdocs build --site-dir prod-build
cd ../../
- name: Zip the Documentation
run: |
mkdir -p out/asgardeo/docs
mkdir -p out-prod/asgardeo/docs
cp -r ./en/asgardeo/site/* out/asgardeo/docs/
cp -r ./en/asgardeo/prod-build/* out-prod/asgardeo/docs/
zip -r asgardeo-docs-${{ env.NEW_VERSION }}.zip ./out
zip -r asgardeo-docs-${{ env.NEW_VERSION }}-prod.zip ./out-prod
- name: Create git tag
run: |
git config user.name $GIT_USERNAME
git config user.email $GIT_USER_EMAIL
git tag "v${{ env.NEW_VERSION }}"
git tag "v${{ env.NEW_VERSION }}-prod"
git push "https://$GIT_USERNAME:[email protected]/${{ github.repository }}" "v${{ env.NEW_VERSION }}"
git push "https://$GIT_USERNAME:[email protected]/${{ github.repository }}" "v${{ env.NEW_VERSION }}-prod"
- name: Create Release
id: create_release
Expand All @@ -115,6 +128,15 @@ jobs:
release_name: Asgardeo Docs - v${{ env.NEW_VERSION }}
draft: false
prerelease: ${{ env.IS_HOTFIX == 'true' }}

- name: Create prod release
id: create_prod_release
uses: actions/create-release@v1
with:
tag_name: v${{ env.NEW_VERSION }}-prod
release_name: Asgardeo Docs - v${{ env.NEW_VERSION }}-prod
draft: false
prerelease: ${{ env.IS_HOTFIX == 'true' }}

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
Expand All @@ -123,6 +145,14 @@ jobs:
asset_path: ./asgardeo-docs-${{ env.NEW_VERSION }}.zip
asset_name: asgardeo-docs-${{ env.NEW_VERSION }}.zip
asset_content_type: application/zip

- name: Upload Prod Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./asgardeo-docs-${{ env.NEW_VERSION }}-prod.zip
asset_name: asgardeo-docs-${{ env.NEW_VERSION }}-prod.zip
asset_content_type: application/zip

- name: Commit and push new version
if: ${{ env.IS_HOTFIX == 'false' }}
Expand Down
19 changes: 10 additions & 9 deletions en/asgardeo/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ def parse_json(file_path):
files_to_remove = parse_json(os.path.join(os.getcwd(), 'features.json'))

def on_files(files, config):
for file in list(files):
if file.src_uri in files_to_remove['page']:
files.remove(file)
return files
if os.getenv("ENABLE_HOOKS") == "true":
for file in list(files):
if file.src_uri in files_to_remove['page']:
files.remove(file)
return files

def remove_nav_item(nav_items):
filtered_items = []
Expand All @@ -45,9 +46,9 @@ def remove_nav_item(nav_items):
return filtered_items

def on_config(config):
if os.getenv("ENABLE_HOOKS") == "true":
for feature, enabled in files_to_remove['feature'].items():
config[feature] = enabled

for feature, enabled in files_to_remove['feature'].items():
config[feature] = enabled

config['nav'] = remove_nav_item(config['nav'])
return config
config['nav'] = remove_nav_item(config['nav'])
return config

0 comments on commit a537b12

Please sign in to comment.