Skip to content

Commit a0c00fd

Browse files
authored
Merge pull request #2 from ttelang/main
Merging changes from main branch to Patch-1
2 parents 90d5a4e + 6ef657a commit a0c00fd

35 files changed

+310
-80
lines changed

.devcontainer/devcontainer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "MicroProfile Tutorial UI",
3+
"features": {
4+
"ghcr.io/devcontainers/features/node:1": {
5+
"version": "lts"
6+
}
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"asciidoctor.asciidoctor-vscode",
12+
"github.vscode-github-actions"
13+
]
14+
}
15+
},
16+
"postCreateCommand": "npm install -g gulp-cli && npm install"
17+
}

.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
node: true,
5+
es6: true
6+
},
7+
extends: 'eslint:recommended',
8+
parserOptions: {
9+
ecmaVersion: 2018,
10+
sourceType: 'module'
11+
},
12+
rules: {
13+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
14+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn'
15+
}
16+
}

.github/pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build:
2+
artifact: "public"

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ jobs:
6060
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}
6161

6262
- name: If published, trigger redeployment of playbook
63-
if: github.event_name == 'push'
63+
if: github.event_name == 'push' && !failure() && !cancelled()
64+
continue-on-error: true
6465
uses: convictional/[email protected]
6566
with:
6667
github_token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
67-
owner: ${{ github.repository_owner }}
68+
owner: ttelang
6869
repo: microprofile-documentation
6970
workflow_file_name: build-and-deploy.yml
7071
wait_interval: 3

.github/workflows/github-pages.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: '18'
28+
29+
- name: Install dependencies
30+
run: npm install
31+
32+
- name: Build site
33+
run: npx gulp github-pages
34+
35+
- name: Setup Pages
36+
uses: actions/configure-pages@v4
37+
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: './public'
42+
43+
deploy:
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
runs-on: ubuntu-latest
48+
needs: build
49+
steps:
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v4

.stylelintrc.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"extends": "stylelint-config-standard",
3+
"rules": {
4+
"indentation": 2,
5+
"string-quotes": null,
6+
"no-duplicate-selectors": true,
7+
"color-hex-case": "lower",
8+
"color-hex-length": "short",
9+
"color-named": "never",
10+
"selector-no-qualifying-type": null,
11+
"selector-combinator-space-after": "always",
12+
"selector-attribute-quotes": "always",
13+
"selector-attribute-operator-space-before": "never",
14+
"selector-attribute-operator-space-after": "never",
15+
"selector-attribute-brackets-space-inside": "never",
16+
"declaration-block-trailing-semicolon": "always",
17+
"declaration-colon-space-before": "never",
18+
"declaration-colon-space-after": "always",
19+
"declaration-colon-newline-after": null,
20+
"number-leading-zero": "always",
21+
"function-url-quotes": null,
22+
"font-weight-notation": null,
23+
"font-family-name-quotes": "always-where-recommended",
24+
"comment-whitespace-inside": "always",
25+
"at-rule-no-vendor-prefix": true,
26+
"rule-empty-line-before": null,
27+
"selector-pseudo-element-colon-notation": "double",
28+
"selector-pseudo-class-parentheses-space-inside": "never",
29+
"media-feature-range-operator-space-before": "always",
30+
"media-feature-range-operator-space-after": "always",
31+
"media-feature-parentheses-space-inside": "never",
32+
"media-feature-colon-space-before": "never",
33+
"media-feature-colon-space-after": "always",
34+
"no-descending-specificity": null,
35+
"comment-empty-line-before": null,
36+
"declaration-empty-line-before": null
37+
}
38+
}

README.adoc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,55 @@ It will generate an UI bundle tagged `latest` which is available as {url-micropr
117117
This bundle is in turn already referenced as `ui.bundle.url` property in `antora-playbook.yml` configuration file of {url-microprofile-tutorial}[MicroProfile Tutorial Playbook].
118118

119119
The live site can be found at {url-microprofile-tutorial-live}[{url-microprofile-tutorial-live}].
120+
121+
== GitHub Pages Deployment
122+
123+
This project can also be built and deployed directly to GitHub Pages, which allows you to host the UI documentation directly from this repository.
124+
125+
=== Building for GitHub Pages
126+
127+
To build the UI for GitHub Pages locally, run:
128+
129+
$ gulp github-pages
130+
131+
This will generate the complete site in the `public` directory, ready for GitHub Pages deployment.
132+
133+
=== Automatic Deployment
134+
135+
The project includes a GitHub Actions workflow that automatically builds and deploys the site to GitHub Pages whenever changes are pushed to the main branch. The workflow:
136+
137+
1. Checks out the repository
138+
2. Sets up Node.js
139+
3. Installs dependencies
140+
4. Builds the site using the `github-pages` task
141+
5. Deploys the built site to GitHub Pages
142+
143+
To enable GitHub Pages for your fork of this repository:
144+
145+
1. Go to your repository's Settings tab
146+
2. Navigate to Pages in the left sidebar
147+
3. Under "Source", select "GitHub Actions"
148+
149+
Once deployed, your site will be available at `https://[username].github.io/microprofile-tutorial-ui/` or at a custom domain if you configure one in the GitHub Pages settings.
150+
151+
This approach allows you to maintain both the UI bundle for Antora and a standalone documentation site from the same repository.
152+
153+
== Development with Dev Containers / GitHub Codespaces
154+
155+
This project includes Dev Container configuration, making it easy to develop using Visual Studio Code Dev Containers or GitHub Codespaces. The development environment comes pre-configured with:
156+
157+
* Node.js LTS
158+
* Gulp CLI for build automation
159+
* GitHub Actions extension for workflow management
160+
* AsciiDoctor extension for documentation editing
161+
162+
=== Using GitHub Codespaces
163+
164+
To start developing using GitHub Codespaces:
165+
166+
1. Go to your repository on GitHub
167+
2. Click the green "Code" button
168+
3. Select the "Codespaces" tab
169+
4. Click "Create codespace on main"
170+
171+
This will create a cloud-based development environment with all dependencies pre-installed.

gulp.d/tasks/build-preview-pages.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module.exports = (src, previewSrc, previewDest, sink = () => map()) => (done) =>
5151
} else {
5252
const doc = Asciidoctor.load(file.contents, { safe: 'safe', attributes: ASCIIDOC_ATTRIBUTES })
5353
uiModel.page.attributes = Object.entries(doc.getAttributes())
54-
.filter(([name, val]) => name.startsWith('page-'))
54+
.filter(([name]) => name.startsWith('page-'))
5555
.reduce((accum, [name, val]) => {
5656
accum[name.substr(5)] = val
5757
return accum
@@ -122,11 +122,11 @@ function copyImages (src, dest) {
122122
.pipe(map((file, enc, next) => next()))
123123
}
124124

125-
function resolvePage (spec, context = {}) {
125+
function resolvePage (spec) {
126126
if (spec) return { pub: { url: resolvePageURL(spec) } }
127127
}
128128

129-
function resolvePageURL (spec, context = {}) {
129+
function resolvePageURL (spec) {
130130
if (spec) return '/' + (spec = spec.split(':').pop()).slice(0, spec.lastIndexOf('.')) + '.html'
131131
}
132132

gulp.d/tasks/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = (src, dest, preview) => () => {
5454
autoprefixer,
5555
preview
5656
? () => {}
57-
: (css, result) => cssnano({ preset: 'default' })(css, result).then(() => postcssPseudoElementFixer(css, result)),
57+
: (css, result) => cssnano({ preset: 'default' })(css, result).then(() => postcssPseudoElementFixer(css)),
5858
]
5959

6060
return merge(
@@ -129,7 +129,7 @@ function bundle ({ base: basedir, ext: bundleExt = '.bundle.js' }) {
129129
})
130130
}
131131

132-
function postcssPseudoElementFixer (css, result) {
132+
function postcssPseudoElementFixer (css) {
133133
css.walkRules(/(?:^|[^:]):(?:before|after)/, (rule) => {
134134
rule.selector = rule.selectors.map((it) => it.replace(/(^|[^:]):(before|after)$/, '$1::$2')).join(',')
135135
})

gulpfile.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ const previewTask = createTask({
111111
call: series(previewBuildTask, previewServeTask),
112112
})
113113

114+
const githubPagesTask = createTask({
115+
name: 'github-pages',
116+
desc: 'Build the UI for GitHub Pages hosting',
117+
call: series(
118+
cleanTask,
119+
previewBuildTask,
120+
() => {
121+
log('Site built for GitHub Pages in the public directory')
122+
return Promise.resolve()
123+
}
124+
)
125+
})
126+
114127
module.exports = exportTasks(
115128
bundleTask,
116129
cleanTask,
@@ -121,5 +134,6 @@ module.exports = exportTasks(
121134
bundlePackTask,
122135
previewTask,
123136
previewBuildTask,
124-
packTask
137+
packTask,
138+
githubPagesTask
125139
)

0 commit comments

Comments
 (0)