Skip to content

Commit 6cf5bf2

Browse files
committed
feat: extension
1 parent 23d2188 commit 6cf5bf2

File tree

10 files changed

+826
-0
lines changed

10 files changed

+826
-0
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags:
8+
- "v*.*.*"
9+
pull_request:
10+
branches:
11+
- develop
12+
13+
concurrency:
14+
group: ${{format('{0}:{1}', github.repository, github.ref)}}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
name: Build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Clone repository
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Tests
34+
run: npm test
35+
36+
publish-npm:
37+
name: Publish NPM package
38+
needs: [ build ]
39+
runs-on: ubuntu-latest
40+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
41+
steps:
42+
- name: Clone repository
43+
uses: actions/checkout@v4
44+
45+
- name: Check version tags
46+
run: |
47+
GITHUB_TAGNAME=${{ github.ref_name }}
48+
if [[ ! $GITHUB_TAGNAME =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
49+
echo "Tag name is not valid. It should match the pattern v*.*.*"
50+
exit 1
51+
fi
52+
PACKAGE_JSON_VERSION=$(node -p "require('./package.json').version")
53+
if [[ $GITHUB_TAGNAME != "v$PACKAGE_JSON_VERSION" ]]; then
54+
echo "Tag name does not match package.json version"
55+
exit 1
56+
fi
57+
58+
- name: Setup Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: 20
62+
registry-url: https://registry.npmjs.org/
63+
64+
- name: Install dependencies
65+
run: npm ci
66+
67+
- name: Generate README.md
68+
run: |
69+
sudo apt install -y pandoc asciidoc-base
70+
asciidoc -b docbook README.adoc
71+
pandoc -f docbook -t markdown README.xml -o README.md
72+
rm README.xml
73+
74+
- name: Publish NPM package
75+
run: npm publish --access public
76+
env:
77+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
78+
79+
publish-github:
80+
name: Publish Github Release
81+
needs: [ build, publish-npm ]
82+
runs-on: ubuntu-latest
83+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
84+
permissions:
85+
contents: write
86+
87+
steps:
88+
- name: Clone repository
89+
uses: actions/checkout@v4
90+
91+
- name: Changelog
92+
uses: alandefreitas/cpp-actions/[email protected]
93+
with:
94+
thank-non-regular: true
95+
96+
- name: Release
97+
uses: softprops/action-gh-release@v2
98+
with:
99+
body_path: CHANGELOG.md

.gitignore

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
### jetbrains
2+
3+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
4+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
5+
6+
# User-specific stuff
7+
.idea/**/workspace.xml
8+
.idea/**/tasks.xml
9+
.idea/**/usage.statistics.xml
10+
.idea/**/dictionaries
11+
.idea/**/shelf
12+
13+
# AWS User-specific
14+
.idea/**/aws.xml
15+
16+
# Generated files
17+
.idea/**/contentModel.xml
18+
19+
# Sensitive or high-churn files
20+
.idea/**/dataSources/
21+
.idea/**/dataSources.ids
22+
.idea/**/dataSources.local.xml
23+
.idea/**/sqlDataSources.xml
24+
.idea/**/dynamic.xml
25+
.idea/**/uiDesigner.xml
26+
.idea/**/dbnavigator.xml
27+
28+
# Gradle
29+
.idea/**/gradle.xml
30+
.idea/**/libraries
31+
32+
# Gradle and Maven with auto-import
33+
# When using Gradle or Maven with auto-import, you should exclude module files,
34+
# since they will be recreated, and may cause churn. Uncomment if using
35+
# auto-import.
36+
# .idea/artifacts
37+
# .idea/compiler.xml
38+
# .idea/jarRepositories.xml
39+
# .idea/modules.xml
40+
# .idea/*.iml
41+
# .idea/modules
42+
# *.iml
43+
# *.ipr
44+
45+
# CMake
46+
cmake-build-*/
47+
48+
# Mongo Explorer plugin
49+
.idea/**/mongoSettings.xml
50+
51+
# File-based project format
52+
*.iws
53+
54+
# IntelliJ
55+
out/
56+
57+
# mpeltonen/sbt-idea plugin
58+
.idea_modules/
59+
60+
# JIRA plugin
61+
atlassian-ide-plugin.xml
62+
63+
# Cursive Clojure plugin
64+
.idea/replstate.xml
65+
66+
# Crashlytics plugin (for Android Studio and IntelliJ)
67+
com_crashlytics_export_strings.xml
68+
crashlytics.properties
69+
crashlytics-build.properties
70+
fabric.properties
71+
72+
# Editor-based Rest Client
73+
.idea/httpRequests
74+
75+
# Android studio 3.1+ serialized cache file
76+
.idea/caches/build_file_checksums.ser
77+
78+
79+
### visualstudiocode
80+
81+
.vscode/*
82+
!.vscode/settings.json
83+
!.vscode/tasks.json
84+
!.vscode/launch.json
85+
!.vscode/extensions.json
86+
*.code-workspace
87+
88+
# Local History for Visual Studio Code
89+
.history/
90+
91+
92+
### node
93+
94+
# Logs
95+
logs
96+
*.log
97+
npm-debug.log*
98+
yarn-debug.log*
99+
yarn-error.log*
100+
lerna-debug.log*
101+
.pnpm-debug.log*
102+
103+
# Diagnostic reports (https://nodejs.org/api/report.html)
104+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
105+
106+
# Runtime data
107+
pids
108+
*.pid
109+
*.seed
110+
*.pid.lock
111+
112+
# Directory for instrumented libs generated by jscoverage/JSCover
113+
lib-cov
114+
115+
# Coverage directory used by tools like istanbul
116+
coverage
117+
*.lcov
118+
119+
# nyc test coverage
120+
.nyc_output
121+
122+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
123+
.grunt
124+
125+
# Bower dependency directory (https://bower.io/)
126+
bower_components
127+
128+
# node-waf configuration
129+
.lock-wscript
130+
131+
# Compiled binary addons (https://nodejs.org/api/addons.html)
132+
build/Release
133+
134+
# Dependency directories
135+
node_modules/
136+
jspm_packages/
137+
138+
# Snowpack dependency directory (https://snowpack.dev/)
139+
web_modules/
140+
141+
# TypeScript cache
142+
*.tsbuildinfo
143+
144+
# Optional npm cache directory
145+
.npm
146+
147+
# Optional eslint cache
148+
.eslintcache
149+
150+
# Microbundle cache
151+
.rpt2_cache/
152+
.rts2_cache_cjs/
153+
.rts2_cache_es/
154+
.rts2_cache_umd/
155+
156+
# Optional REPL history
157+
.node_repl_history
158+
159+
# Output of 'npm pack'
160+
*.tgz
161+
162+
# Yarn Integrity file
163+
.yarn-integrity
164+
165+
# dotenv environment variables file
166+
.env
167+
.env.test
168+
.env.production
169+
170+
# parcel-bundler cache (https://parceljs.org/)
171+
.cache
172+
.parcel-cache
173+
174+
# Next.js build output
175+
.next
176+
out
177+
178+
# Nuxt.js build / generate output
179+
.nuxt
180+
dist
181+
182+
# Gatsby files
183+
.cache/
184+
# Comment in the public line in if your project uses Gatsby and not Next.js
185+
# https://nextjs.org/blog/next-9-1#public-directory-support
186+
# public
187+
188+
# vuepress build output
189+
.vuepress/dist
190+
191+
# Serverless directories
192+
.serverless/
193+
194+
# FuseBox cache
195+
.fusebox/
196+
197+
# DynamoDB Local files
198+
.dynamodb/
199+
200+
# TernJS port file
201+
.tern-port
202+
203+
# Stores VSCode versions used for testing VSCode extensions
204+
.vscode-test
205+
206+
# yarn v2
207+
.yarn/cache
208+
.yarn/unplugged
209+
.yarn/build-state.yml
210+
.yarn/install-state.gz
211+
.pnp.*
212+
213+
214+
.idea/
215+
*.iml
216+
217+
example/doc/build/
218+
example/build/

LICENSE_1_0.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Boost Software License - Version 1.0 - August 17th, 2003
2+
3+
Permission is hereby granted, free of charge, to any person or organization
4+
obtaining a copy of the software and accompanying documentation covered by
5+
this license (the "Software") to use, reproduce, display, distribute,
6+
execute, and transmit the Software, and to prepare derivative works of the
7+
Software, and to permit third-parties to whom the Software is furnished to
8+
do so, all subject to the following:
9+
10+
The copyright notices in the Software and this entire statement, including
11+
the above license grant, this restriction and the following disclaimer,
12+
must be included in all copies of the Software, in whole or in part, and
13+
all derivative works of the Software, unless such copies or derivative
14+
works are solely in the form of machine-executable object code generated by
15+
a source language processor.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
DEALINGS IN THE SOFTWARE.

README.adoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
11
= Antora Playbook Macros Extension
22

3+
This allows you to use macros in your Antora playbook.
4+
5+
== Configuration
6+
7+
=== npm
8+
9+
Install this extension
10+
11+
[source,bash]
12+
----
13+
npm i -D @alandefreitas/antora-playbook-macros-extension
14+
----
15+
16+
=== Playbook
17+
18+
Append the following in your `playbook.yaml`:
19+
20+
[source,yaml]
21+
----
22+
antora:
23+
extensions:
24+
- require: '@alandefreitas/antora-playbook-macros-extension' # <1>
25+
macros: # <2>
26+
key1: value1
27+
key2: value2
28+
----
29+
30+
* <1> `npm` package name: `@alandefreitas/antora-playbook-macros-extension` (required)
31+
* <2> List of default macros and values (optional)
32+
33+
== Using macros
34+
35+
Any value in the playbook can use a macro with the `${key}` syntax. The value will be replaced by the macro value as defined by one of the following sources:
36+
37+
1. Environment variable
38+
2. Uppercase environment variable
39+
3. Asciidoc attribute
40+
4. Default value
41+
5. Predefined macros
42+
43+
Asciidoc attributes comes from the `asciidoc.attributes` section of the playbook. They can also be set in the antora command line using the `--attribute` option.
44+
45+
Default values are defined in the `macros` section of extension configuration. The provide a way to define default values for macros that are not set in any other source.
46+
47+
The predefined macros are:
48+
49+
- `branch`: The current branch name as per `git rev-parse --abbrev-ref HEAD`
50+
- `commit-id`: The current commit hash as per `git rev-parse HEAD`

0 commit comments

Comments
 (0)