Skip to content

Commit

Permalink
🔧 (main.yml): add base URL configuration and Ruby setup for Jekyll build
Browse files Browse the repository at this point in the history
Add `nkdAgility_DocsBaseURL` to support dynamic base URLs for Jekyll builds.
Include Ruby setup to ensure the correct environment for Jekyll.
Switch from using `jekyll-build-action` to a direct Jekyll build command.

These changes allow for more flexible and environment-specific documentation
deployments, ensuring the base URL is correctly set based on the deployment
context. The Ruby setup ensures that the necessary dependencies for Jekyll
are installed and cached, improving build reliability and performance.
  • Loading branch information
MrHinsh committed Aug 17, 2024
1 parent d899e3c commit fa9603d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ jobs:
nkdAgility_ReleaseDescription: ${{ steps.nkdagility.outputs.release_description }}
nkdAgility_ReleaseDescriptionState: ${{ steps.nkdagility.outputs.release_description_state }}
nkdAgility_DocsDeployFolder: ${{ steps.nkdagility.outputs.docs_deploy_folder }}
nkdAgility_DocsBaseURL: ${{ steps.nkdagility.outputs.docs_baseURL }}
nkdAgility_DocsVersionFolder: ${{ steps.nkdagility.outputs.docs_version_folder }}
nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }}

steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -96,25 +98,29 @@ jobs:
$Ring = "Canary"
$WingetApplicationId = "nkdagility.azure-devops-migration-tools"
$docs_deploy_folder = "./azure-devops-migration-tools/";
$docs_baseURL = "/learn/azure-devops-migration-tools"
$RunCodeRelease = 'false'
$RunDocsRelease = 'false'
switch ($Env:GitVersion_PreReleaseLabel) {
"" {
$Ring = "Release";
$WingetApplicationId = "nkdagility.azure-devops-migration-tools";
$docs_deploy_folder = "./azure-devops-migration-tools/"
$docs_baseURL = "/learn/azure-devops-migration-tools"
$RunRelease = 'true'
}
"Preview" {
$Ring = "Preview";
$WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview";
$docs_deploy_folder = "./azure-devops-migration-tools/preview/";
$docs_baseURL = "/learn/azure-devops-migration-tools/preview/"
$RunRelease = ( ('${{ inputs.ForceRelease }}' -eq 'true' ) -or ('${{ steps.filter.outputs.src }}' -eq 'true') -or ('${{ steps.filter.outputs.docs }}' -eq 'true') )
}
default {
$Ring = "Canary";
$WingetApplicationId = "nkdagility.azure-devops-migration-tools.Canary";
$docs_deploy_folder = "./azure-devops-migration-tools/canary/"
$docs_baseURL = "/learn/azure-devops-migration-tools/canary/"
$RunRelease = 'false'
}
}
Expand All @@ -124,6 +130,8 @@ jobs:
echo "WingetApplicationId=$WingetApplicationId" >> $env:GITHUB_OUTPUT
Write-Output "docs_deploy_folder=$docs_deploy_folder"
echo "docs_deploy_folder=$docs_deploy_folder" >> $env:GITHUB_OUTPUT
Write-Output "docs_baseURL=$docs_baseURL"
echo "docs_baseURL=$docs_baseURL" >> $env:GITHUB_OUTPUT
Write-Output "RunRelease=$RunRelease"
echo "RunRelease=$RunRelease" >> $env:GITHUB_OUTPUT
Write-Output "-------------------------------------------"
Expand Down Expand Up @@ -183,6 +191,7 @@ jobs:
- nkdAgility_WingetApplicationId: ${{needs.Setup.outputs.nkdAgility_WingetApplicationId}}
- nkdAgility_DocsVersionFolder: ${{needs.Setup.outputs.nkdAgility_DocsVersionFolder}}
- nkdAgility_DocsDeployFolder: ${{needs.Setup.outputs.nkdAgility_DocsDeployFolder}}
- nkdAgility_DocsBaseURL: ${{needs.Setup.outputs.nkdAgility_DocsBaseURL}}
- nkdAgility_ReleaseDescriptionState: ${{needs.Setup.outputs.nkdAgility_ReleaseDescriptionState}}
- nkdAgility_RunRelease: ${{needs.Setup.outputs.nkdAgility_RunRelease}}
### GitVersion
Expand Down Expand Up @@ -305,6 +314,12 @@ jobs:
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }}
steps:
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- uses: cschleiden/replace-tokens@v1
with:
files: '["**/*.html"]'
Expand All @@ -318,8 +333,13 @@ jobs:
- uses: igsekor/[email protected]
id: spellcheck
name: Spellcheck
- name: Build Jekyll
uses: jerryjvl/jekyll-build-action@v1
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{needs.Setup.outputs.nkdAgility_DocsBaseURL}}"
env:
JEKYLL_ENV: production
# - name: Build Jekyll
# uses: jerryjvl/jekyll-build-action@v1
- uses: actions/upload-artifact@v4
with:
name: AzureDevOpsMigrationTools-Site
Expand Down

0 comments on commit fa9603d

Please sign in to comment.