|
| 1 | +name: Build and Deploy Songbook |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + pages: write |
| 15 | + id-token: write |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: "pages" |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Set up Python |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: '3.11' |
| 33 | + |
| 34 | + - name: Install TeX Live |
| 35 | + run: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get install -y \ |
| 38 | + texlive-latex-base \ |
| 39 | + texlive-latex-extra \ |
| 40 | + texlive-fonts-recommended \ |
| 41 | + texlive-fonts-extra \ |
| 42 | + texlive-xetex \ |
| 43 | + latexmk |
| 44 | + |
| 45 | + - name: Install Python dependencies |
| 46 | + run: | |
| 47 | + python -m pip install --upgrade pip |
| 48 | + pip install git+https://github.com/carmiac/openlyric_bookmaker.git |
| 49 | + |
| 50 | + - name: Build songbook |
| 51 | + run: | |
| 52 | + openlyric_bookmaker --config book_config.toml |
| 53 | + |
| 54 | + - name: Create GitHub Pages structure |
| 55 | + run: | |
| 56 | + mkdir -p gh-pages |
| 57 | + # Copy HTML output |
| 58 | + cp -r output/html/* gh-pages/ |
| 59 | + # Copy PDFs |
| 60 | + mkdir -p gh-pages/pdfs |
| 61 | + cp output/pdfs/*.pdf gh-pages/pdfs/ || true |
| 62 | + # Create landing page |
| 63 | + cat > gh-pages/downloads.html << 'EOF' |
| 64 | + <!DOCTYPE html> |
| 65 | + <html lang="en"> |
| 66 | + <head> |
| 67 | + <meta charset="UTF-8"> |
| 68 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 69 | + <title>The Swilling Swede's Songbook - Downloads</title> |
| 70 | + <link rel="stylesheet" href="stylesheets/custom-theme.css"> |
| 71 | + <style> |
| 72 | + body { |
| 73 | + font-family: Georgia, 'Times New Roman', serif; |
| 74 | + margin: 0; |
| 75 | + padding: 0; |
| 76 | + background: linear-gradient(135deg, #FFF8E7 0%, #FFE4B5 100%); |
| 77 | + min-height: 100vh; |
| 78 | + } |
| 79 | + .container { |
| 80 | + max-width: 900px; |
| 81 | + margin: 0 auto; |
| 82 | + padding: 40px 20px; |
| 83 | + } |
| 84 | + .header { |
| 85 | + text-align: center; |
| 86 | + background: linear-gradient(135deg, #8B0000 0%, #5C0000 100%); |
| 87 | + color: #D4AF37; |
| 88 | + padding: 60px 20px; |
| 89 | + border-radius: 10px; |
| 90 | + box-shadow: 0 8px 16px rgba(139, 0, 0, 0.3); |
| 91 | + margin-bottom: 40px; |
| 92 | + border: 3px solid #D4AF37; |
| 93 | + } |
| 94 | + .header h1 { |
| 95 | + margin: 0 0 20px 0; |
| 96 | + font-size: 3em; |
| 97 | + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); |
| 98 | + } |
| 99 | + .header p { |
| 100 | + font-size: 1.2em; |
| 101 | + font-style: italic; |
| 102 | + margin: 10px 0; |
| 103 | + color: #F4D03F; |
| 104 | + } |
| 105 | + .section { |
| 106 | + background: white; |
| 107 | + padding: 30px; |
| 108 | + border-radius: 10px; |
| 109 | + margin-bottom: 30px; |
| 110 | + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); |
| 111 | + border-left: 5px solid #D4AF37; |
| 112 | + } |
| 113 | + .section h2 { |
| 114 | + color: #8B0000; |
| 115 | + border-bottom: 3px solid #D4AF37; |
| 116 | + padding-bottom: 10px; |
| 117 | + margin-top: 0; |
| 118 | + } |
| 119 | + .button-group { |
| 120 | + display: grid; |
| 121 | + grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); |
| 122 | + gap: 20px; |
| 123 | + margin-top: 20px; |
| 124 | + } |
| 125 | + .btn { |
| 126 | + display: inline-block; |
| 127 | + padding: 15px 30px; |
| 128 | + background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%); |
| 129 | + color: #D4AF37; |
| 130 | + text-decoration: none; |
| 131 | + border-radius: 5px; |
| 132 | + text-align: center; |
| 133 | + font-weight: bold; |
| 134 | + font-size: 1.1em; |
| 135 | + transition: all 0.3s ease; |
| 136 | + border: 2px solid #D4AF37; |
| 137 | + box-shadow: 0 4px 6px rgba(139, 0, 0, 0.3); |
| 138 | + } |
| 139 | + .btn:hover { |
| 140 | + background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%); |
| 141 | + transform: translateY(-3px); |
| 142 | + box-shadow: 0 6px 12px rgba(139, 0, 0, 0.4); |
| 143 | + color: #F4D03F; |
| 144 | + } |
| 145 | + .btn-primary { |
| 146 | + grid-column: 1 / -1; |
| 147 | + background: linear-gradient(135deg, #D4AF37 0%, #B8860B 100%); |
| 148 | + color: #5C0000; |
| 149 | + border: 2px solid #8B0000; |
| 150 | + } |
| 151 | + .btn-primary:hover { |
| 152 | + background: linear-gradient(135deg, #F4D03F 0%, #D4AF37 100%); |
| 153 | + color: #8B0000; |
| 154 | + } |
| 155 | + .description { |
| 156 | + color: #5C4033; |
| 157 | + line-height: 1.8; |
| 158 | + margin: 15px 0; |
| 159 | + } |
| 160 | + .footer { |
| 161 | + text-align: center; |
| 162 | + padding: 30px; |
| 163 | + color: #5C4033; |
| 164 | + font-style: italic; |
| 165 | + } |
| 166 | + .icon { |
| 167 | + margin-right: 10px; |
| 168 | + font-size: 1.2em; |
| 169 | + } |
| 170 | + </style> |
| 171 | + </head> |
| 172 | + <body> |
| 173 | + <div class="container"> |
| 174 | + <div class="header"> |
| 175 | + <h1>🍺 The Swilling Swede's Songbook 🍺</h1> |
| 176 | + <p>A collection of songs humbly presented for your amusement</p> |
| 177 | + <p>Preferably around a campfire while drinking mead, scotch, beer, or rum</p> |
| 178 | + <p>And surrounded by good company</p> |
| 179 | + </div> |
| 180 | + |
| 181 | + <div class="section"> |
| 182 | + <h2>📖 Browse Online</h2> |
| 183 | + <p class="description"> |
| 184 | + View the complete songbook in your browser with our interactive HTML version. |
| 185 | + Perfect for quick reference and searching. |
| 186 | + </p> |
| 187 | + <div class="button-group"> |
| 188 | + <a href="index.html" class="btn btn-primary"> |
| 189 | + <span class="icon">🎵</span>View Songbook Online |
| 190 | + </a> |
| 191 | + </div> |
| 192 | + </div> |
| 193 | + |
| 194 | + <div class="section"> |
| 195 | + <h2>📥 Download PDFs</h2> |
| 196 | + <p class="description"> |
| 197 | + Download the songbook in various PDF formats for different purposes. |
| 198 | + All versions contain the same songs, just formatted differently. |
| 199 | + </p> |
| 200 | + <div class="button-group"> |
| 201 | + <a href="pdfs/SwillingSwedesSongbook-BoundPrint.pdf" class="btn"> |
| 202 | + <span class="icon">📕</span>Bound Print Version |
| 203 | + </a> |
| 204 | + <a href="pdfs/SwillingSwedesSongbook-Display.pdf" class="btn"> |
| 205 | + <span class="icon">🖥️</span>Display Version |
| 206 | + </a> |
| 207 | + <a href="pdfs/SwillingSwedesSongbook-eReader.pdf" class="btn"> |
| 208 | + <span class="icon">📱</span>eReader Version |
| 209 | + </a> |
| 210 | + </div> |
| 211 | + <p class="description" style="margin-top: 20px; font-size: 0.9em;"> |
| 212 | + <strong>Bound Print:</strong> Two-sided printing with wider inner margins for binding<br> |
| 213 | + <strong>Display:</strong> Single-sided with balanced margins, great for screen viewing<br> |
| 214 | + <strong>eReader:</strong> Optimized for tablets and e-readers with minimal margins |
| 215 | + </p> |
| 216 | + </div> |
| 217 | + |
| 218 | + <div class="section"> |
| 219 | + <h2>ℹ️ About</h2> |
| 220 | + <p class="description"> |
| 221 | + This songbook is a collection of songs from my days in the SCA at the College of St. Golias and since. |
| 222 | + It is compiled from many sources and is a work in progress, updated as time allows. |
| 223 | + </p> |
| 224 | + <p class="description"> |
| 225 | + <strong>Author:</strong> Sveinn the Swilling Swede<br> |
| 226 | + <strong>License:</strong> <a href="https://creativecommons.org/licenses/by-sa/4.0/" style="color: #8B0000;">CC BY-SA 4.0</a><br> |
| 227 | + <strong>Source:</strong> <a href="https://github.com/carmiac/SwillingSwedesSongbook" style="color: #8B0000;">GitHub Repository</a> |
| 228 | + </p> |
| 229 | + </div> |
| 230 | + |
| 231 | + <div class="footer"> |
| 232 | + <p>🎶 Sing with gusto! 🎶</p> |
| 233 | + </div> |
| 234 | + </div> |
| 235 | + </body> |
| 236 | + </html> |
| 237 | + EOF |
| 238 | + |
| 239 | + - name: Upload artifact |
| 240 | + uses: actions/upload-pages-artifact@v3 |
| 241 | + with: |
| 242 | + path: 'gh-pages' |
| 243 | + |
| 244 | + deploy: |
| 245 | + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' |
| 246 | + environment: |
| 247 | + name: github-pages |
| 248 | + url: ${{ steps.deployment.outputs.page_url }} |
| 249 | + runs-on: ubuntu-latest |
| 250 | + needs: build |
| 251 | + |
| 252 | + steps: |
| 253 | + - name: Deploy to GitHub Pages |
| 254 | + id: deployment |
| 255 | + uses: actions/deploy-pages@v4 |
0 commit comments