Skip to content

Commit f1c166c

Browse files
committed
Deploy autogenerated docs
This solution is not able to deal with multiple versions. VERSION can be omitted, using the latest tag INSTALLPATH is only used upon build action to place autogeneraed into the correct location. Signed-off-by: Martin Alfke <ma@betadots.de>
1 parent 1209544 commit f1c166c

15 files changed

Lines changed: 41 additions & 23 deletions

File tree

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575

7676
- name: Build website
7777
run: |
78+
bundle exec references:openfact INSTALLPATH=docs
79+
bundle exec references:openvox INSTALLPATH=docs
7880
bundle exec jekyll build
7981
- name: Archive website
8082
run: |

Rakefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,20 @@ CLOBBER.include('references_output')
2828
desc 'List the available groups of references. Run `rake references:<GROUP>` to build.'
2929
task :references do
3030
puts 'The following references are available:'
31-
puts 'bundle exec rake references:openvox VERSION=<GIT TAG OR COMMIT>'
32-
puts 'bundle exec rake references:openfact VERSION=<GIT TAG OR COMMIT>'
31+
puts 'bundle exec rake references:openvox [VERSION=<GIT TAG OR COMMIT> INSTALLPATH=<RELATIVE OR ABSOLUTE PATH>]'
32+
puts 'bundle exec rake references:openfact [VERSION=<GIT TAG OR COMMIT> INSTALLPATH=<RELATIVE OR ABSOLUTE PATH>]'
3333
puts 'bundle exec rake references:version_tables'
34+
puts ' VERSION can be omitted, uses latest tag'
35+
puts ' INSTALLPATH can be omitted, defaults to references_output/'
3436
end
3537

3638
namespace :references do
37-
task openvox: 'references:check_version' do
39+
task openvox: 'references:check' do
3840
require 'puppet_references'
3941
PuppetReferences.build_puppet_references(ENV.fetch('VERSION', nil))
4042
end
4143

42-
task openfact: 'references:check_version' do
44+
task openfact: 'references:check' do
4345
require 'puppet_references'
4446
PuppetReferences.build_facter_references(ENV.fetch('VERSION', nil))
4547
end
@@ -49,7 +51,9 @@ namespace :references do
4951
PuppetReferences.build_version_tables
5052
end
5153

52-
task :check_version do
53-
abort 'No VERSION given to build references for' unless ENV['VERSION']
54+
task :check do
55+
puts 'No VERSION given to build references for - using latest tag' unless ENV['VERSION']
56+
puts "Using provided install path #{ENV.fetch('INSTALLPATH')} instead of default" if ENV['INSTALLPATH']
57+
puts "Using default install path 'references_output'" unless ENV['INSTALLPATH']
5458
end
5559
end

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ exclude:
128128
- util
129129
- vendor
130130
- WORKFLOW.md
131+
- WORKFLOW_reference.md

lib/puppet_references.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module PuppetReferences
77
PUPPET_DIR = BASE_DIR + 'vendor/openvox'
88
FACTER_DIR = BASE_DIR + 'vendor/openfact'
99
AGENT_DIR = BASE_DIR + 'vendor/openvox-agent'
10-
OUTPUT_DIR = BASE_DIR + 'references_output'
10+
INSTALLPATH = ENV['INSTALLPATH'] ? ENV.fetch('INSTALLPATH') : 'references_output'
11+
OUTPUT_DIR = BASE_DIR + INSTALLPATH
1112

1213
require 'puppet_references/config'
1314
require 'puppet_references/util'
@@ -37,7 +38,9 @@ def self.build_puppet_references(commit)
3738
]
3839
config = PuppetReferences::Config.read
3940
repo = PuppetReferences::Repo.new('openvox', PUPPET_DIR, nil, config['puppet']['repo'])
40-
real_commit = repo.checkout(commit)
41+
version_commit = commit || repo.describe.split('-')[0]
42+
puts "Using tag #{version_commit}"
43+
real_commit = repo.checkout(version_commit)
4144
repo.update_bundle
4245
build_from_list_of_classes(references, real_commit)
4346
end
@@ -54,11 +57,13 @@ def self.build_facter_references(commit)
5457
# we need the CLI docs for 3.y. We can remove this when we stop building 3.y.
5558
version4 = Gem::Version.create('4.0.0')
5659
repo = PuppetReferences::Repo.new('openfact', FACTER_DIR)
57-
real_commit = repo.checkout(commit)
60+
version_commit = commit || repo.describe.split('-')[0]
61+
puts "Using tag #{version_commit}"
62+
real_commit = repo.checkout(version_commit)
5863
repo.update_bundle
59-
if !semantic?(commit) || (semantic?(commit) && Gem::Version.create(commit) >= version4)
64+
if !semantic?(version_commit) || (semantic?(version_commit) && Gem::Version.create(version_commit) >= version4)
6065
references << PuppetReferences::Facter::FacterCli
61-
elsif semantic?(commit) && Gem::Version.create(commit) < version4
66+
elsif semantic?(version_commit) && Gem::Version.create(version_commit) < version4
6267
reference = PuppetReferences::Facter::FacterCli.new(real_commit)
6368
reference.build_v3_cli
6469
end

lib/puppet_references/facter/core_facts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module PuppetReferences
55
module Facter
66
class CoreFacts < PuppetReferences::Reference
7-
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openfact'
7+
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openfact_latest'
88
PREAMBLE_FILE = Pathname.new(__FILE__).dirname + 'core_facts_preamble.md'
99
PREAMBLE = PREAMBLE_FILE.read
1010

lib/puppet_references/facter/facter_cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module PuppetReferences
55
module Facter
66
class FacterCli < PuppetReferences::Reference
7-
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openfact'
7+
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openfact_latest'
88
PREAMBLE_FILE = Pathname.new(__FILE__).dirname + 'facter_cli_preamble.md'
99
PREAMBLE = PREAMBLE_FILE.read
1010

lib/puppet_references/puppet/functions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module PuppetReferences
1010
module Puppet
1111
class Functions < PuppetReferences::Reference
1212
TEMPLATE_FILE = Pathname.new(File.expand_path(__FILE__)).dirname + 'functions_template.erb'
13-
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox'
13+
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
1414
PREAMBLE_FILE = Pathname.new(File.expand_path(__FILE__)).dirname + 'functions_preamble.md'
1515
PREAMBLE = PREAMBLE_FILE.read
1616

lib/puppet_references/puppet/http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module PuppetReferences
66
module Puppet
77
class Http < PuppetReferences::Reference
8-
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox'
8+
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
99
DOCS_DIR = OUTPUT_DIR + 'http_api'
1010
API_SOURCE = PuppetReferences::PUPPET_DIR + 'api'
1111

lib/puppet_references/puppet/man.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module PuppetReferences
66
module Puppet
77
class Man < PuppetReferences::Reference
8-
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox/man'
8+
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest/man'
99

1010
def initialize(*)
1111
@latest = '/openvox/latest/man'

lib/puppet_references/puppet/puppet_doc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module PuppetReferences
55
module Puppet
66
class PuppetDoc < PuppetReferences::Reference
77
REFERENCES = %w[configuration].freeze
8-
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox'
8+
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
99

1010
def initialize(*)
1111
@latest = '/openvox/latest'

0 commit comments

Comments
 (0)