Skip to content

Commit

Permalink
ci: add docusaurus-prince-pdf generation (open-sauced#24)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
0-vortex committed Nov 5, 2021
1 parent 6ec78ef commit 8d4bacf
Show file tree
Hide file tree
Showing 8 changed files with 1,527 additions and 45 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,9 @@ on:
- edited
- synchronize

jobs:
semantics:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v3.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

welcome:
runs-on: ubuntu-latest
needs: semantics
if: github.event.action == 'opened'
permissions:
pull-requests: write

steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-message: |-
Congrats on making your first Pull Request and thanks for taking the time to improve Open Sauced! ❤️! 🎉🍕
Say hello by joining the conversation in our [Discord](https://discord.gg/U2peSNf23P)
jobs:
compliance:
uses: open-sauced/open-sauced/.github/workflows/compliance.yml@main
2 changes: 2 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "🔧 setup node"
uses: actions/setup-node@v2.1.5
Expand Down
62 changes: 56 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,31 @@ jobs:
- name: "🔧 setup buildx"
uses: docker/setup-buildx-action@v1

- name: "🔧 cache docker layers"
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: "🔧 docker meta"
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ github.repository }}
tags: latest

- name: "📦 docker build"
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ github.repository }}:latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/docker.tar
push: false
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}

- name: "📂 docker artifacts"
uses: actions/upload-artifact@v2
Expand All @@ -46,7 +64,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json', '**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand Down Expand Up @@ -89,7 +107,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json', '**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand Down Expand Up @@ -137,6 +155,11 @@ jobs:
- build
- release
runs-on: ubuntu-latest
services:
docs:
image: ghcr.io/${{ github.repository }}:latest
ports:
- 8080:80
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
Expand All @@ -147,10 +170,37 @@ jobs:
name: build
path: /home/runner/build

- name: "📂 copy artifacts"
- name: Install Prince
run: |
cp -R /home/runner/build .
ls -lahH ./build
curl https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -O
tar zxf prince-14.2-linux-generic-x86_64.tar.gz
cd prince-14.2-linux-generic-x86_64
yes "" | sudo ./install.sh
- name: "🔧 setup node"
uses: actions/setup-node@v2.1.5
with:
node-version: 14

- name: "🔧 setup cache"
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: "🔧 install npm@latest"
run: npm i -g npm@latest

- name: "📦 install dependencies"
run: npm ci

- name: "📂 copy artifacts"
run: cp -R /home/runner/build .

- name: "🚀 generate pdf"
run: npm run pdf

- name: "🚀 deploy static"
uses: peaceiris/actions-gh-pages@v3
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

</div>


## 🧪 Built for Experimenting

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).
Expand Down
4 changes: 4 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ module.exports = {
{
label: 'Blog',
href: 'https://dev.to/opensauced',
},
{
label: 'Download book',
href: 'https://docs.opensauced.pizza/open-sauced-docs.pdf',
}
],
},
Expand Down
Loading

0 comments on commit 8d4bacf

Please sign in to comment.