Skip to content

Add index page

Add index page #46

Workflow file for this run

name: Ibis Next eBook Generation and Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: gd, zip, mbstring
coverage: none
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader
- name: Generate PDF (Light Theme)
run: composer run pdf
- name: Generate PDF (Dark Theme)
run: composer run pdf-dark
- name: Generate EPUB
run: composer run epub
- name: Generate HTML
run: composer run html
- name: Generate Sample PDF (Light Theme)
run: composer run sample && composer run sample-dark
- name: Check for changes
id: verify-changed-files
run: |
if git diff --quiet HEAD -- ebook/en/export/; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.verify-changed-files.outputs.changed == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git config --local user.email "bobby@bobbyiliev.com"
git config --local user.name "Bobby Iliev"
git add ebook/en/export/
git commit -m "🤖 Auto-update eBook files [skip ci]" || exit 0
git push
- name: Upload eBook artifacts
uses: actions/upload-artifact@v4
with:
name: ebooks-${{ github.sha }}
path: |
ebook/en/export/*.pdf
ebook/en/export/*.epub
ebook/en/export/*.html
retention-days: 90
- name: Create Release (on main push with changes)
if: steps.verify-changed-files.outputs.changed == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.run_number }}
name: eBook Release v${{ github.run_number }}
body: |
## 📚 101 Linux Commands eBook - Release v${{ github.run_number }}
This release contains the latest version of the eBook in multiple formats:
- **PDF (Light Theme)**: Ideal for printing and desktop reading
- **PDF (Dark Theme)**: Perfect for dark mode readers
- **EPUB**: Compatible with e-readers, tablets, and mobile devices
- **HTML**: Single-page web version for online reading
### 📥 Downloads
Choose your preferred format from the assets below.
### 🔄 Changes
This release was automatically generated from commit ${{ github.sha }}.
### 🙏 Contributing
Want to help improve this eBook? Check out our [contributing guidelines](CONTRIBUTING.md).
files: |
ebook/en/export/101-linux-commands-light.pdf
ebook/en/export/101-linux-commands-dark.pdf
ebook/en/export/101-linux-commands.epub
ebook/en/export/101-linux-commands.html
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy-pages:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: gd, zip, mbstring
coverage: none
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader
- name: Generate HTML for Pages
run: composer run html
- name: Create Pages directory
run: |
mkdir -p _site
cp ebook/en/export/101-linux-commands.html _site/index.html
# Create a simple redirect page at the root
cat > _site/README.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="0; url=./index.html">
<title>101 Linux Commands eBook</title>
<style>
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
.redirect { background: #f0f8ff; padding: 20px; border-radius: 10px; display: inline-block; }
a { color: #007acc; text-decoration: none; font-weight: bold; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="redirect">
<h1>📚 101 Linux Commands eBook</h1>
<p>Redirecting to the eBook...</p>
<p>If you're not redirected automatically, <a href="./index.html">click here</a>.</p>
</div>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4