Skip to content

Commit 8d4bacf

Browse files
authored
ci: add docusaurus-prince-pdf generation (#24)
* ci: test pdf generation * test: test * ci: test always on remote * ci: add pdf release management * feat: add open sauced book and download link * ci: add docker build caching to github actions * ci: update compliance workflows from open-sauced/open-sauced
1 parent 6ec78ef commit 8d4bacf

File tree

8 files changed

+1527
-45
lines changed

8 files changed

+1527
-45
lines changed

Diff for: .github/workflows/compliance.yml

+5-19
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,9 @@ on:
77
- edited
88
- synchronize
99

10-
jobs:
11-
semantics:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: amannn/[email protected]
15-
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17-
18-
welcome:
19-
runs-on: ubuntu-latest
20-
needs: semantics
21-
if: github.event.action == 'opened'
10+
permissions:
11+
pull-requests: write
2212

23-
steps:
24-
- uses: actions/first-interaction@v1
25-
with:
26-
repo-token: ${{ secrets.GITHUB_TOKEN }}
27-
pr-message: |-
28-
Congrats on making your first Pull Request and thanks for taking the time to improve Open Sauced! ❤️! 🎉🍕
29-
Say hello by joining the conversation in our [Discord](https://discord.gg/U2peSNf23P)
13+
jobs:
14+
compliance:
15+
uses: open-sauced/open-sauced/.github/workflows/compliance.yml@main

Diff for: .github/workflows/development.yml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
steps:
1111
- name: "☁️ checkout repository"
1212
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
1315

1416
- name: "🔧 setup node"
1517
uses: actions/[email protected]

Diff for: .github/workflows/release.yml

+56-6
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,31 @@ jobs:
1616
- name: "🔧 setup buildx"
1717
uses: docker/setup-buildx-action@v1
1818

19+
- name: "🔧 cache docker layers"
20+
uses: actions/cache@v2
21+
with:
22+
path: /tmp/.buildx-cache
23+
key: ${{ runner.os }}-buildx-${{ github.sha }}
24+
restore-keys: |
25+
${{ runner.os }}-buildx-
26+
27+
- name: "🔧 docker meta"
28+
id: meta
29+
uses: docker/metadata-action@v3
30+
with:
31+
images: ${{ github.repository }}
32+
tags: latest
33+
1934
- name: "📦 docker build"
2035
uses: docker/build-push-action@v2
2136
with:
2237
context: .
23-
tags: ${{ github.repository }}:latest
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}
2440
outputs: type=docker,dest=/tmp/docker.tar
2541
push: false
42+
cache-from: type=gha, scope=${{ github.workflow }}
43+
cache-to: type=gha, scope=${{ github.workflow }}
2644

2745
- name: "📂 docker artifacts"
2846
uses: actions/upload-artifact@v2
@@ -46,7 +64,7 @@ jobs:
4664
uses: actions/cache@v2
4765
with:
4866
path: ~/.npm
49-
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
67+
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json', '**/package-lock.json') }}
5068
restore-keys: |
5169
${{ runner.os }}-node-
5270
@@ -89,7 +107,7 @@ jobs:
89107
uses: actions/cache@v2
90108
with:
91109
path: ~/.npm
92-
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
110+
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json', '**/package-lock.json') }}
93111
restore-keys: |
94112
${{ runner.os }}-node-
95113
@@ -137,6 +155,11 @@ jobs:
137155
- build
138156
- release
139157
runs-on: ubuntu-latest
158+
services:
159+
docs:
160+
image: ghcr.io/${{ github.repository }}:latest
161+
ports:
162+
- 8080:80
140163
steps:
141164
- name: "☁️ checkout repository"
142165
uses: actions/checkout@v2
@@ -147,10 +170,37 @@ jobs:
147170
name: build
148171
path: /home/runner/build
149172

150-
- name: "📂 copy artifacts"
173+
- name: Install Prince
151174
run: |
152-
cp -R /home/runner/build .
153-
ls -lahH ./build
175+
curl https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -O
176+
tar zxf prince-14.2-linux-generic-x86_64.tar.gz
177+
cd prince-14.2-linux-generic-x86_64
178+
yes "" | sudo ./install.sh
179+
180+
- name: "🔧 setup node"
181+
uses: actions/[email protected]
182+
with:
183+
node-version: 14
184+
185+
- name: "🔧 setup cache"
186+
uses: actions/cache@v2
187+
with:
188+
path: ~/.npm
189+
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
190+
restore-keys: |
191+
${{ runner.os }}-node-
192+
193+
- name: "🔧 install npm@latest"
194+
run: npm i -g npm@latest
195+
196+
- name: "📦 install dependencies"
197+
run: npm ci
198+
199+
- name: "📂 copy artifacts"
200+
run: cp -R /home/runner/build .
201+
202+
- name: "🚀 generate pdf"
203+
run: npm run pdf
154204

155205
- name: "🚀 deploy static"
156206
uses: peaceiris/actions-gh-pages@v3

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
</div>
1414

15+
1516
## 🧪 Built for Experimenting
1617

1718
This tool is meant to accelerate development on [Open Sauced](https://opensauced.pizza) by giving contributors a way to access [Docusaurus 2](https://docusaurus.io/) powered developer documentation available at [docs.opensauced.pizza](https://docs.opensauced.pizza).

Diff for: docusaurus.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ module.exports = {
104104
{
105105
label: 'Blog',
106106
href: 'https://dev.to/opensauced',
107+
},
108+
{
109+
label: 'Download book',
110+
href: 'https://docs.opensauced.pizza/open-sauced-docs.pdf',
107111
}
108112
],
109113
},

0 commit comments

Comments
 (0)