Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Official GitHub Actions action does not work on macOS #11010

Open
myitcv opened this issue May 24, 2023 · 14 comments
Open

Official GitHub Actions action does not work on macOS #11010

myitcv opened this issue May 24, 2023 · 14 comments

Comments

@myitcv
Copy link
Contributor

myitcv commented May 24, 2023

What version of Hugo are you using (hugo version)?

$ hugo version
v0.112.1

Does this issue reproduce with the latest release?

Yes

Please can I confirm that https://github.com/peaceiris/actions-hugo is the official action to install Hugo in GitHub Actions workflows? Is there an official place where this is documented?

Assuming that it is, there are two blockers to using that action to install Hugo on macOS:

peaceiris/actions-hugo#605
peaceiris/actions-hugo#608

It feels like there should be an official Hugo-project owned and maintained action to make the installation of Hugo as part of GitHub Actions seamless.

Thoughts?

@jmooring
Copy link
Member

jmooring commented May 24, 2023

Our recommended GitHub Action is based on GitHub's Starter Action for Hugo.

You would need to modify our recommended GitHub Action to be compatible with macOS. I have never tried this; I have never had a need to use anything other than Ubuntu in a CI/CD workflow.

Please use the forum (https://discourse.gohugo.io/) for questions and troubleshooting. We prefer to use GitHub for verified bugs and vetted enhancements. Thanks.

@bep
Copy link
Member

bep commented May 24, 2023

I'll reopen this. It's limited what we as a project can do, but this issue is at least within the scope of things I care (and know a little) about.

@bep bep reopened this May 24, 2023
@myitcv
Copy link
Contributor Author

myitcv commented May 25, 2023

I'll reopen this.

Thanks @bep. My suggestion would be something like github.com/gohugoio/setup-hugo as a GitHub action that knows how to install Hugo on various platforms. In the same spirit as https://github.com/actions/setup-go and friends. That should be a relatively simple action, because all it would do is shim the installation of the binaries Hugo already produces for every platform.

The main use case here (and I'm sure I can't be the first to run into this) is to ensure that all developers of https://github.com/cue-lang/cuelang.org can reliably follow steps in a readme and know that they will work. That requires us to have a build matrix that includes macOS (and windows, at a later date).

@bep
Copy link
Member

bep commented May 25, 2023

@myitcv yea, we can do something like that ... as to naming the repo ... setup-actions-hugo? Sounds a little clumsy, but it makes room for other "setup" repos later...

@myitcv
Copy link
Contributor Author

myitcv commented May 25, 2023

Sounds a little clumsy, but it makes room for other "setup" repos later...

Do you know of any such patterns that exist today?

The setup-* pattern is so common with GitHub actions.

I'd suggest unless there are compelling reasons to stray from that (i.e. a clash with another very common pattern), the GitHub pattern is likely to dominate and hence be most "accessible" for folks.

@bep
Copy link
Member

bep commented May 25, 2023

The setup-* pattern is so common with GitHub actions.

The example you gave had that context in the org name, actions/setup-go. Adding gohugoio/setup-hugo would

  1. Not tell me that it's about GitHub actions.
  2. Give an indication that it's an all purpose "Hugo setup tool", whatever that is...

@myitcv
Copy link
Contributor Author

myitcv commented May 25, 2023

The example you gave had that context in the org name, actions/setup-go

That's a good point.

We (perhaps wrongly therefore) went with https://github.com/cue-lang/setup-cue.

Building on your context point, I'll throw ghactions-setup-hugo out there as an alternative.

cc @mvdan who often has good ideas re naming.

@mvdan
Copy link
Contributor

mvdan commented May 30, 2023

How about action-setup-hugo or actions-setup-hugo? I don't think one needs to repeat github or shorten it like gh, since the repo is under github.com after all, and "actions" is a well known concept in the context of a GitHub repo already.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label May 30, 2024
@myitcv
Copy link
Contributor Author

myitcv commented May 30, 2024

This is still relevant.

@agriyakhetarpal
Copy link

Please feel free to run the latest and greatest versions of Hugo (extended) through a combination of actions/setup-python and pipx via the pipx run hugo==<your hugo version here> new site mysite command or similar commands of your liking. I would like to note that this distribution is unaffiliated with the Hugo developers here at the time of writing and is a community-maintained unofficial build.

@github-actions github-actions bot removed the Stale label May 31, 2024
@bep bep added this to the v0.131.0 milestone Jul 22, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@yochem
Copy link

yochem commented Aug 27, 2024

I would like this too, because:

  • Keeping the current "official" way up to date is cumbersome. I sometimes visit this gohugo.io documentation page to update my action workflow to use the current recommended commands
  • Currently no way to set version to 'latest'
  • I'd rather use an "official" action than one from a random gh user
  • The default action for deploying hugo on gh pages would be easy to grasp:
name: Deploy Hugo site to Pages

on:
  push:
    branches:
      - main

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Pages
        uses: actions/configure-pages@v5

      - name: Hugo
        uses: gohugoio/hugo-action@v1

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./public

      - name: Deploy to GitHub Pages
        uses: actions/deploy-pages@v4

I would also suggest that the action runs the hugo command to simplify general usage. Passing an args argument would allow for more advanced usage of Hugo. Therefore, I suggest the name to be hugo-action instead of setup-hugo, since it not only sets up hugo, but also runs it.

@agriyakhetarpal
Copy link

Totally reasonable on your part, @yochem – I would have pitched for my own project and its builds, but I understand the lack of trust that can come from unofficial, community-maintained ones.

You could use the https://github.com/jmooring/hvm CLI tool to set up Hugo from the official releases with not too many lines of code.

@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
@yochem
Copy link

yochem commented Sep 6, 2024

I could have a go with this if that's welcome.

There are 3 different approaches for building custom GH actions:

  1. Typescript/javascript. Runs native on runners, github provides modules to interact with actions inputs and more
  2. Docker. Very flexible, not so fast.
  3. Composed. This is like a normal actions workflow, where you define steps in the yaml file. Could for example be different shell commands. Also seems fast?

Approach 1 might not be desired because most other Hugo things are in Go.

Approach 2 might have a lot of overhead for the little that this action has to do (install and run hugo).

Approach 3 it is not clear if it can be done in Go. We could opt for a simple shell script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants