Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy to GitHub Pages
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this part.


on:
push:
branches: [ master ]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
working-directory: .jekyll

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Build site
run: cd .jekyll && ./build.sh
env:
JEKYLL_ENV: production

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.build
.swiftpm
.DS_Store
.vscode
.vscode

# Jekyll
_site
.jekyll/index.md
7 changes: 7 additions & 0 deletions .jekyll/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
_site
.sass-cache
.jekyll-cache
.jekyll-metadata
Gemfile.lock
index.md
assets/css/syntax.css
10 changes: 10 additions & 0 deletions .jekyll/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source "https://rubygems.org"

# Jekyll
gem "jekyll", "~> 4.3"

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end
11 changes: 11 additions & 0 deletions .jekyll/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Jekyll Site

Jekyll configuration for GitHub Pages.

## Local Development

```bash
./serve.sh
```

Open http://localhost:4000
24 changes: 24 additions & 0 deletions .jekyll/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Jekyll configuration for Airbnb Swift Style Guide

# Basic settings
title: Airbnb Swift Style Guide
description: Official Swift style guide for Airbnb
baseurl: "/swift"
url: "https://bachand.github.io"

# Syntax highlighting
markdown: kramdown
highlighter: rouge

kramdown:
syntax_highlighter: rouge
syntax_highlighter_opts:
default_lang: swift
parse_block_html: true

# Build settings
exclude:
- Gemfile
- Gemfile.lock
- .gitignore
- README.md
27 changes: 27 additions & 0 deletions .jekyll/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ page.title | default: site.title }}</title>
<link rel="stylesheet" href="{{ '/assets/css/syntax.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
</head>
<body>
<div class="container">
<header>
<h1>{{ site.title }}</h1>
<p>{{ site.description }}</p>
<a href="https://github.com/airbnb/swift">View on GitHub</a>
</header>

<main>
{{ content }}
</main>

<footer>
<p>&copy; Airbnb</p>
</footer>
</div>
</body>
</html>
96 changes: 96 additions & 0 deletions .jekyll/assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
body {
font-family: system-ui, sans-serif;
line-height: 1.6;
margin: 0;
}

:root {
--rausch: #FF5A5F;
}

.container {
max-width: 900px;
margin: 0 auto;
padding: 20px;
}

header {
border-bottom: 1px solid #ddd;
border-left: 3px solid var(--rausch);
padding-left: 20px;
padding-bottom: 20px;
margin-bottom: 40px;
}

header a {
color: var(--rausch);
text-decoration: none;
font-weight: 500;
}

header a:hover {
text-decoration: underline;
}

h2 {
border-bottom: 1px solid #eee;
padding-bottom: 8px;
}

code {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 3px;
font-family: monospace;
font-size: 90%;
}

pre {
background: #f8f8f8;
border: 1px solid #e1e4e8;
border-radius: 6px;
padding: 16px;
overflow-x: auto;
line-height: 1.5;
}

pre code {
background: none;
padding: 0;
font-size: 14px;
font-family: 'SF Mono', Monaco, Menlo, 'Courier New', monospace;
}

footer {
border-top: 1px solid #ddd;
padding-top: 20px;
margin-top: 60px;
text-align: center;
color: #666;
}

details {
margin: 20px 0;
}

summary {
cursor: pointer;
font-weight: 600;
user-select: none;
margin-bottom: 16px;
}

details[open] summary {
margin-bottom: 16px;
}

details pre {
margin-top: 0;
margin-bottom: 16px;
}

details pre:last-child {
margin-bottom: 0;
}


15 changes: 15 additions & 0 deletions .jekyll/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Script to build the Jekyll site

set -e

./prepare-content.sh

echo "📦 Installing dependencies..."
bundle install

echo "🔨 Building Jekyll site..."
bundle exec jekyll build --destination ../_site

echo "✅ Build complete! Output in _site/"
15 changes: 15 additions & 0 deletions .jekyll/prepare-content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Shared script to prepare content for Jekyll

echo "📋 Copying guide.md to index.md with frontmatter..."
{
echo "---"
echo "layout: default"
echo "---"
echo ""
cat ../guide.md | sed 's/<details>/<details markdown="1">/g'
} > index.md

echo "🎨 Generating syntax highlighting CSS..."
bundle exec rougify style github.light > assets/css/syntax.css
15 changes: 15 additions & 0 deletions .jekyll/serve.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Script to test the Jekyll site locally

set -e

./prepare-content.sh

echo "📦 Installing dependencies..."
bundle install

echo "🚀 Starting Jekyll server..."
echo "Site will be available at: http://localhost:4000"
echo "Press Ctrl+C to stop"
bundle exec jekyll serve --baseurl ""
Loading
Loading