Skip to content

Commit

Permalink
Add build action
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkiro committed Nov 14, 2024
1 parent 26e1bfd commit 4732166
Show file tree
Hide file tree
Showing 17 changed files with 1,440 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
indent_size = 2
tab_width = 2
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VITE_BASE_URL="/"
VITE_APP_TITLE="Flip Forge"
VITE_BACKGROUND_COLOR="#000000"
VITE_TOOLBAR_COLOR="#ffffff"
VITE_PAGE_NUMBER="60"
VITE_FILE_DOWNLOAD="book.pdf"
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy test
on:
workflow_dispatch:


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
file: test/lorem_ipsum.pdf
title: "LOREM IPSUM"
- name: Upload artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: dist
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/settings.json
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
.tmp
.book.pdf
public
.env
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v1.0.0

Initial release
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# build-flip-forge

Build a static page with flip-forge from a PDF
71 changes: 71 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "deploy-flip-forge"
branding:
icon: book-open
color: purple
description: "Deploy flip forge on GitHub pages"

inputs:
file:
description: "PDF file to convert."
required: true
title:
description: "Page title"
required: false
default: "Flip forge"
backgroundColor:
description: "Background color"
required: false
default: "#000000"
toolbarColor:
description: "Toolbar color"
required: false
default: "#ffffff"
baseUrl:
description: "Base URL of the app"
required: false
default: "/"
outputs:
dist:
description: "Dist folder"
value: ${{ steps.dist.outputs.dist }}


runs:
using: "composite"
steps:
- name: "Install poppler"
shell: bash
run: |
sudo apt update -y
sudo apt install -y poppler-utils
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: "Install dependencies"
run: |
npm ci
- name: "Convert to images"
shell: bash
env:
INPUT_FILE: ${{ inputs.file }}
run: |
mkdir public
cp "$INPUT_FILE" public/
pdftocairo "$INPUT_FILE" -jpeg public/page
- name: "Build site"
env:
INPUT_FILE: ${{ inputs.file }}
VITE_BASE_URL: ${{ inputs.baseUrl }}
VITE_APP_TITLE: ${{ inputs.title }}
VITE_BACKGROUND_COLOR: ${{ inputs.backgroundColor }}
VITE_TOOLBAR_COLOR: ${{ inputs.toolbarColor }}
shell: bash
run: |
export VITE_PAGE_NUMBER="$(ls -1 public/ | wc -l)"
export VITE_FILE_DOWNLOAD=$(basename "$INPUT_FILE")
npm run build
- name: Set dist folder
id: dist
shell: bash
run: echo "dist=$(realpath dist)" >> $GITHUB_OUTPUT
3 changes: 3 additions & 0 deletions events.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"action": "workflow_dispatch"
}
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>%VITE_APP_TITLE%</title>
</head>
<body style="background-color: %VITE_BACKGROUND_COLOR%">
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
Loading

0 comments on commit 4732166

Please sign in to comment.