1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub ActionsでHugoのビルドを試したらshortcode "gallery" not foundになった

Posted at

GitHub ActionsでHugoのビルドを試したらshortcode "gallery" not foundになった

Hugoでのビルド作業やGitHub Pagesへのデプロイ作業を、GitHub Actionsで自動化したいなぁと思っていたところ、以下の記事を見つけました。

GitHub Actions による GitHub Pages への自動デプロイ

さっそくやってみたところ、 hugo --minify の箇所で以下のエラーがでました。

Run hugo --minify
  hugo --minify
  shell: /bin/bash -e {0}
Building sites … Total in 27 ms
Error: Error building site: "/home/runner/work/xxx/xxx/content/home/gallery/index.md:12:1": failed to extract shortcode: template for shortcode "gallery" not found
## [error]Process completed with exit code 255.

サブモジュールの取得漏れが原因

ソースコード側では、Academic ThemeというHugoのテーマを参照しています。この参照方法が少し特殊で、Gitのサブモジュールという仕組みを使っています。

エラーの原因を調査したところ、GitHub Actions側では、このAcademic Themeのフォルダーが空になっていることがわかりました。

調査を進めると、Gitのサブモジュールの取得ができていないことがわかりました。

サブモジュールを取得するようにする

gh-pages.yml の最初のステップの部分を以下のように変更してみました。

steps:
- uses: actions/checkout@v1
  with:
    submodules: true

そしたら、エラーが出なくなり、無事にデプロイが成功しました。

さいごに

本記事作成にあたり、以下のページを参考にしました。ありがとうございました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?