Skip to content

Commit

Permalink
Merge pull request #151 from oleg-nenashev/3.x-links
Browse files Browse the repository at this point in the history
Deploy the 3.x links too, same as the main branch
  • Loading branch information
oleg-nenashev authored Aug 30, 2023
2 parents eab841f + 29f5ed2 commit 6bd87d0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
bundle exec jekyll build --config '../../_config.yml,../../_config-2.x.yml' --baseurl "${{ steps.pages.outputs.base_path }}/2.x"
env:
JEKYLL_ENV: development
# TODO: Add 3.x build? It is just a config file tweak, so maybe better to not slowdown for now


# TODO: Uncomment when cleaned up (if ever)
# - name: Validate HTML and links
# uses: anishathalye/proof-html@v2
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ jobs:
bundle exec jekyll build --config '../../_config.yml,../../_config-2.x.yml' --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Deploy 2.x to the website
# Outputs to the './_site' directory by default
- name: Build 3.x with Jekyll
# We use the same as the root build, but with additional config
run: |
bundle exec jekyll build --config '_config.yml,_config-3.x.yml' --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Deploy version branches to the website
run: |
ruby .scripts/merge-sitemaps.rb
mkdir _site/2.x
cp -R .submodules/wiremock.org-2.x/tmp/site_2x/* _site/2.x/
env:
JEKYLL_ENV: production
mkdir _site/3.x
cp -R tmp/site_3x/* _site/3.x/
# TODO: Uncomment when cleaned up (if ever)
# - name: Validate HTML and links
# uses: anishathalye/proof-html@v2
Expand Down
26 changes: 16 additions & 10 deletions .scripts/merge-sitemaps.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
# Merges sitemaps, to be called from the root directory
header, footer, content1, content2 = []
header, footer, content_main, content_2x, content_3x = []

File.open( "_site/sitemap.xml", 'r' ) do |f1|
content1 = (IO.readlines f1)
header = content1.slice!( 0..11 )
footer = [ content1.slice!( -1 ) ]
content_main = (IO.readlines f1)
header = content_main.slice!( 0..11 )
footer = [ content_main.slice!( -1 ) ]
end

File.open( ".submodules/wiremock.org-2.x/tmp/site_2x/sitemap.xml", 'r' ) do |f2|
content2 = (IO.readlines f2)
content2.slice!( 0..11 )
content2.slice!( -1 )
content_2x = (IO.readlines f2)
content_2x.slice!( 0..11 )
content_2x.slice!( -1 )
end

File.open( "_site/sitemap.xml", 'w' ) do |f3|
f3.write ( header + content1 + content2 + footer ).join()
File.open( "./tmp/site_3x/sitemap.xml", 'r' ) do |f3|
content_3x = (IO.readlines f3)
content_3x.slice!( 0..11 )
content_3x.slice!( -1 )
end

File.open( "_site/sitemap.xml", 'w' ) do |f4|
f4.write ( header + content_main + content_2x + content_3x + footer ).join()
end


puts "Merged main and 3.x sitemaps"
puts "Merged main and version sitemaps"
2 changes: 2 additions & 0 deletions _config-3.x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
url: "https://wiremock.org/3.x"
destination: "./tmp/site_3x"

0 comments on commit 6bd87d0

Please sign in to comment.