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

Support asciidoc (asciidoctor) #342

Closed
reitzig opened this issue May 27, 2020 · 8 comments
Closed

Support asciidoc (asciidoctor) #342

reitzig opened this issue May 27, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request resolved resolved issue support User support

Comments

@reitzig
Copy link

reitzig commented May 27, 2020

Is your feature request related to a problem? Please describe.

I use AsciiDoc in my site. I would like to use this GitHub action, but it doesn't seem to contain asciidoctor.

Describe the solution you'd like

Similar to extended mode, an option to add asciidoctor to this action (assuming it's too heavy a dependency to always include).

Describe alternatives you've considered

Using another action: the ones I checked seem less refined and maintained than this one.

Additional context

Additional facilities to add command-line parameters for asciidoctor would be gread, cf
gohugoio/hugo#6561

@reitzig reitzig added the proposal Feature request label May 27, 2020
@peaceiris
Copy link
Owner

Did you try the following?

- run: sudo gem install asciidoctor

Also we can use the apt or bundle to install asciidoctor.

@peaceiris peaceiris added support User support and removed proposal Feature request labels May 27, 2020
@reitzig
Copy link
Author

reitzig commented May 27, 2020

Ah, now I understand the difference between a Docker-based action and one like yours a little bit better, I think. Thank you!

That seems to work -- basically. asciidoctor in the 18.04 repos is ancient, so gem it is, with a twist:

- name: Setup asciidoctor
        run: |
          sudo gem update --system 3.0.6 # cf. https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885
          ruby --version
          gem --version
          sudo gem install asciidoctor

This runs for a full minute... T_T

Unfortunately, my workaround for Hugo's ... clumsy handling of external tools doesn't seem to work on Github Actions. 🤔 Tinker tinker...

Update: Ah, I was being an idiot, I think. As my own README reminds me 🤦‍♂️ you have to add the working directory to PATH for that workaround to work.

@reitzig reitzig closed this as completed May 27, 2020
@reitzig
Copy link
Author

reitzig commented May 27, 2020

Heh, got it. For the benefit of googlers:

  - name: Setup asciidoctor
    run: |
      sudo gem update --system 3.0.6
      sudo gem install asciidoctor
      sudo .github/scripts/reroute_asciidoctor.sh
      ruby --version; gem --version; asciidoctor --version

With this as .github/scripts/reroute_asciidoctor.sh:

#!/bin/bash

set -eu

binary="$(which asciidoctor)"
binary_orig="${binary}"_orig

if [[ -L "${binary}" ]]; then
    echo "Can not handle links yet"
    exit 1
fi

mv "${binary}" "${binary_orig}"

cat > "${binary}" <<BASH
#!/bin/bash

"${binary_orig}" \
    --attribute=experimental=true \
    --attribute=icons=font \
    "\$@"
BASH
chmod +x "${binary}"

echo "Updated '${binary}' to call '${binary_orig}' with extra parameters."

I guess it's easy to pull out the extra parameters so they appear in the workflow YAML instead, but not tonight. :'D

@peaceiris
Copy link
Owner

I reopened this for updating the README.

@reitzig Could you review this pull-request? reitzig/today-i-learned#1

@peaceiris peaceiris reopened this May 27, 2020
@peaceiris peaceiris added the enhancement New feature or request label May 27, 2020
@peaceiris peaceiris changed the title Support asciidoc Support asciidoc (asciidoctor) May 27, 2020
@reitzig
Copy link
Author

reitzig commented May 27, 2020

Very cool, thanks for your efforts!

Which change of the README do you have an in mind? Do you need me to do something?

I feel like doing this -- adding asciidoctor to a hugo setup, specifically, with workarounds -- could be a dedicated action. I'd be happy to collaborate!

@peaceiris
Copy link
Owner

peaceiris commented May 27, 2020

We are going to add a new section under Tips - README.md like the section for autoprefixer and postcss-cli. If you will work on this, I'll gladly merge it.

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7

      - run: gem install asciidoctor
      - run: |
          alias asciidoctor="asciidoctor --attribute=experimental=true --attribute=icons=font"
          hugo --minify

@reitzig
Copy link
Author

reitzig commented May 29, 2020

Just to point out the alternative here: https://github.com/reitzig/actions-asciidoctor

@peaceiris peaceiris added the resolved resolved issue label Jun 25, 2021
@github-actions
Copy link

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved.
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request resolved resolved issue support User support
Projects
None yet
Development

No branches or pull requests

2 participants