-
Notifications
You must be signed in to change notification settings - Fork 31
Dfoulks/asciidoc #77
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
base: main
Are you sure you want to change the base?
Dfoulks/asciidoc #77
Changes from all commits
5eee76d
caa4df7
088342e
e7254b1
c3d2f25
2f2bbb3
d2996d0
4b1d544
03a9f1e
08ed942
e84241f
50227f2
745a16d
2bed37c
bd92ead
bd5644a
4ad7b6d
1ec87e9
b12b4b2
3b2aae7
96af62a
f4956dc
088cf57
81127a9
873156e
2898a38
264fa6f
54d2010
e4a527f
711c2c6
ab58dae
c630afb
c58beac
7a671e6
0f07ba2
213669c
eca9cda
3fbbd2d
1a604d1
6f01bdc
e0612f9
1e76ebd
7053581
3f4156e
6dca734
0b2c8c5
062d8ae
9d42ac9
b2b1e83
452d3ad
a8edeea
d98ed62
ed3e27f
bd2cd16
5a1a8ec
ed671d1
17108ea
66d3e2e
1da446c
2f608dd
f553880
3989dc2
f52a17e
d45f602
f4d1059
15747a1
1af72cc
c22adb5
2c2fb7b
cd362ac
d1c09a4
92ff2dd
d6cabc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
node_modules/* | ||
package-lock.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Build Presentations with AsciiDoc | ||
description: "Generate a Slidedeck from AsciiDoc Markdown" | ||
inputs: | ||
srcdir: | ||
description: "AsciiDoc sourcefile directory" | ||
required: false | ||
default: "srcfiles" | ||
assets: | ||
description: "Site assets directory" | ||
required: false | ||
default: "static" | ||
dest_branch: | ||
description: "Slidedeck Output branch" | ||
required: false | ||
default: "presentations" | ||
publish: | ||
description: "Publish the site to the destination branch. If false, the site is built but not published." | ||
required: false | ||
type: boolean | ||
default: false | ||
output: | ||
description: "AsciiDoc output directory" | ||
required: false | ||
default: "output" | ||
tempdir: | ||
description: "Temporary Directory name" | ||
required: false | ||
default: "output.tmp" | ||
debug: | ||
description: "AsciiDoc Debug mode" | ||
required: false | ||
default: "false" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
- name: Install AsciiDoc | ||
shell: bash | ||
# Install needs to run in separate shell so stdout is restored | ||
run: | | ||
( | ||
test "${{ inputs.debug }}" == 'true' || exec >/dev/null | ||
npm install | ||
) | ||
working-directory: "${{ github.action_path }}" | ||
|
||
- name: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please name your steps |
||
shell: bash | ||
run: | | ||
mkdir "${{ inputs.output }}" | ||
ln -s "${{ github.action_path }}/convert-slides.js" . | ||
for file in `ls`; do | ||
if [[ "$(echo $file | awk -F. '{print $NF}')" != "adoc" ]]; then | ||
continue | ||
fi | ||
echo $file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this not make the output very noisy? Maybe use groups to structure the log see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was all ripped from the pelican action. If there's a better / more GHA way to approach this, I'm 100% interested. |
||
node convert-slides.js $file | ||
mv $(basename $file .adoc).html "${{ inputs.output }}"/ | ||
done | ||
cp "${{ github.action_path }}/package.json" "${{ inputs.output }}" | ||
[ -d "${{ github.workspace }}/${{ inputs.assets }}" ] && cp -r "${{ github.workspace }}/${{ inputs.assets }}" "${{ inputs.output }}" || echo "No ${{ inputs.assets }} found!" | ||
working-directory: "${{ inputs.srcdir }}" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add an That way you could check the created artifacts when running the action in a PR or something. (and we can use it in testing) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can use to |
||
# - name: Check out previous branch | ||
# if: ${{ inputs.publish == 'true' }} | ||
# shell: bash | ||
# run: | | ||
# git config --global user.email "[email protected]" | ||
# git config --global user.name "AsciiDcotor (action)" | ||
# git remote update | ||
# if git checkout "${{ inputs.dest_branch }}" | ||
# then | ||
# git pull origin "${{ inputs.dest_branch }}" | ||
# else | ||
# # if none, create it. | ||
# echo "branch ${{ inputs.dest_branch }} is new; create empty site" | ||
# git switch --orphan "${{ inputs.dest_branch }}" | ||
# git checkout "origin/${{ github.ref_name }}" -- .asf.yaml | ||
# git add .asf.yaml -f | ||
# git commit -m "Initialise empty site" | ||
# git push -u origin "${{ inputs.dest_branch }}" | ||
# fi | ||
# working-directory: "${{ inputs.srcdir }}" | ||
|
||
# - name: Commit Directly to the branch | ||
# if: ${{ inputs.publish == 'true' }} | ||
# shell: bash | ||
# run: | | ||
# # Remove all existing output so deletions will be captured | ||
# rm -rf "${{ inputs.output }}" | ||
# git rm --quiet -r --ignore-unmatch --cached "${{ inputs.output }}"/* | ||
# mv "${{ inputs.srcdir }}/${{ inputs.tempdir }}" "${{ inputs.output }}" | ||
# git diff # Show changes | ||
# git add "${{ inputs.output }}" | ||
# git status | ||
# if git commit -m "Commit build products" | ||
# then | ||
# git push | ||
# else | ||
# echo "No change" | ||
# true # ensure step is successful | ||
# fi | ||
# | ||
- run: npm install | ||
shell: bash | ||
working-directory: "${{ inputs.srcdir }}/${{ inputs.output }}" | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: '${{ inputs.srcdir }}/${{ inputs.output }}' | ||
- name: Deploy to GitHub Pages[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like a typo at the end '[' ? |
||
id: deployment | ||
uses: actions/deploy-pages@v4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Run syntax: node convert-slides.js filename.adoc | ||
// Load Asciidoctor.js and the reveal.js converter | ||
var asciidoctor = require('@asciidoctor/core')() | ||
var asciidoctorRevealjs = require('@asciidoctor/reveal.js') | ||
asciidoctorRevealjs.register() | ||
|
||
// Convert the document 'presentation.adoc' using the reveal.js converter | ||
var options = { safe: 'safe', backend: 'revealjs' } | ||
asciidoctor.convertFile(process.argv[2], options) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
= Example Presentation | ||
// Header info goes here | ||
:revealjs_template: sky | ||
:imagedir: static/images | ||
|
||
== Slide 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"dependencies": { | ||
"@asciidoctor/core": "^3.0.4", | ||
"@asciidoctor/reveal.js": "^5.1.0", | ||
"asciidoctor": "^3.0.4", | ||
"reveal": "^0.0.4" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's an offical action and this doesn't require pinning in workflows I think it still makes sense within an action as the user has no control over it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would there be a way to test this / keep this hash up to date with dependabot or something? Trying to prevent having to touch this everytime there's an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes dependabot can do it, just add the dir with action.yml to the
directories
list in dependabot.ymlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would pin all actions also the ones coming from GitHub. The positive side effect is that your action does not have uncertainty wrt which exact action is being used. We have seen in the past that sometimes bugs are introduces in newly released versions and when you use just @v4 you will always get the latest released version of the v4 branch of that action. Having it pinned to an exact version makes actions more stable imho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw. you can use https://github.com/eclipse-csi/octopin for pinning.
install with
pipx install octocpin