Skip to content

Commit 376ccd3

Browse files
GitHub action Writerside version 1
0 parents  commit 376ccd3

4 files changed

Lines changed: 132 additions & 0 deletions

File tree

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Container image that runs your code
2+
FROM registry.jetbrains.team/p/writerside/builder/writerside-builder:2.1.984
3+
4+
# Copies your code file from your action repository to the filesystem path `/` of the container
5+
COPY entrypoint.sh /entrypoint.sh
6+
7+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
8+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# A GitHub action for building a Writerside docs artifacts in a Docker container
2+
3+
This action creates a zip-archive with HTMLs from markdown or semantic markup topics.
4+
5+
## Environment variables
6+
7+
### `ARTIFACT`
8+
9+
The name of the archive is webHelpXX2-all.zip where XX gets replaced by the instance id in caps.
10+
11+
### `PRODUCT`
12+
13+
The $PRODUCT should be name_of_module / instance_id, for example sample_module/sd. No default value.
14+
15+
## Example usage with the build HTMLs only
16+
17+
```yml
18+
name: Build docs
19+
20+
on:
21+
push:
22+
branches: ["main"]
23+
24+
workflow_dispatch:
25+
26+
env:
27+
PRODUCT: module/instance-id
28+
ARTIFACT: webHelpXX2-all.zip
29+
30+
jobs:
31+
build-job:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v3
36+
- name: Build Writerside docs with docker
37+
uses: JetBrains/writerside-github-action@v1
38+
- name: Upload artifact
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: artifact
42+
path: artifacts/${{ env.ARTIFACT }}
43+
retention-days: 7
44+
```
45+
46+
47+
## Example usage with build and publish to GitHub pages
48+
49+
```yml
50+
name: Build docs
51+
52+
on:
53+
push:
54+
branches: ["main"]
55+
56+
workflow_dispatch:
57+
58+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
59+
permissions:
60+
contents: read
61+
pages: write
62+
id-token: write
63+
64+
env:
65+
PRODUCT: module/instance-id
66+
ARTIFACT: webHelpXX2-all.zip
67+
68+
jobs:
69+
build-job:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@v3
74+
- name: Build Writerside docs with docker
75+
uses: JetBrains/writerside-github-action@v1
76+
- name: Upload artifact
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: artifact
80+
path: artifacts/${{ env.ARTIFACT }}
81+
retention-days: 7
82+
83+
deploy:
84+
environment:
85+
name: github-pages
86+
url: ${{ steps.deployment.outputs.page_url }}
87+
needs: build-job
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Download artifact
91+
uses: actions/download-artifact@v3
92+
with:
93+
name: artifact
94+
- name: Unzip artifact
95+
uses: montudor/action-zip@v1
96+
with:
97+
args: unzip -qq ${{ env.ARTIFACT }} -d dir
98+
- name: Setup Pages
99+
uses: actions/configure-pages@v2
100+
- name: Upload artifact
101+
uses: actions/upload-pages-artifact@v1
102+
with:
103+
path: dir
104+
- name: Deploy to GitHub Pages
105+
id: deployment
106+
uses: actions/deploy-pages@v1
107+
108+
```

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Build Writerside docs with Docker
2+
description: Build Writerside documentation artifacts
3+
author: writerside <writerside@jetbrains.com>
4+
branding:
5+
icon: book-open
6+
color: purple
7+
8+
runs:
9+
using: 'docker'
10+
image: 'Dockerfile'

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -e
4+
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir . -product $PRODUCT -output-dir artifacts/ || true
5+
echo "Test existing of $ARTIFACT artifact"
6+
test -e artifacts/$ARTIFACT

0 commit comments

Comments
 (0)