Skip to content

Commit

Permalink
Simply use configued nanoc output directory
Browse files Browse the repository at this point in the history
Rather than complicating things with the ability to specify an
output directory in this action, simply use the configured output
directory from the nanoc project. The output will be relative to
the specified source directory.
  • Loading branch information
SamStephens committed Jun 20, 2022
1 parent 1cf494e commit d4b1460
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
uses: ./
with:
source: ./test_projects/${{ matrix.test }}
destination: ./test_projects/${{ matrix.test }}/_site

- name: Verify output
run: |
Expand Down
8 changes: 0 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ inputs:
description: 'Directory where the source files reside.'
required: false
default: ./
destination:
description: 'Output directory of the build. Although it can be nested inside the source, it cannot be the same as the source directory.'
required: false
default: ./_site
project_nanoc_output_dir:
description: "The configured output directory of the Nanoc project. Defaults to 'output'"
required: false
default: output
verbose:
description: 'Verbose output'
required: false
Expand Down
5 changes: 2 additions & 3 deletions bin/compare_expected_output
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ require "shellwords"
project_path = ARGV[0]

Dir.chdir(project_path)
puts Dir['**/*.*']

expected_files = Dir["_expected/**/*"].select { |path| File.file?(path) }.map { |path| Pathname.new(path).relative_path_from("_expected").to_s }
actual_files = Dir["_site/**/*"].select { |path| File.file?(path) }.map { |path| Pathname.new(path).relative_path_from("_site").to_s }
actual_files = Dir["output/**/*"].select { |path| File.file?(path) }.map { |path| Pathname.new(path).relative_path_from("output").to_s }

differences = []

expected_files.each do |expected_file|
if actual_files.include?(expected_file)
diff = `diff #{Shellwords.escape(File.join("_expected", expected_file))} #{Shellwords.escape(File.join("_site", expected_file))}`
diff = `diff #{Shellwords.escape(File.join("_expected", expected_file))} #{Shellwords.escape(File.join("output", expected_file))}`
if !$?.success?
differences << "Expected output of #{expected_file} differs:\n#{diff}"
end
Expand Down
4 changes: 0 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
set -o errexit

SOURCE_DIRECTORY=${GITHUB_WORKSPACE}/$INPUT_SOURCE
DESTINATION_DIRECTORY=${GITHUB_WORKSPACE}/$INPUT_DESTINATION
PROJECT_NANOC_OUTPUT_DIRECTORY=${SOURCE_DIRECTORY}/${INPUT_PROJECT_NANOC_OUTPUT_DIR}

# Set verbose flag
if [ "$INPUT_VERBOSE" = 'true' ]; then
Expand All @@ -22,5 +20,3 @@ fi
cd "$SOURCE_DIRECTORY"
bundle install
bundle exec nanoc compile "$VERBOSE"

mv "$PROJECT_NANOC_OUTPUT_DIRECTORY" "$DESTINATION_DIRECTORY"

0 comments on commit d4b1460

Please sign in to comment.