mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2025-11-08 04:01:11 -06:00
98 lines
3.0 KiB
YAML
98 lines
3.0 KiB
YAML
name: Release the book and website
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
LATEST_IMAGE: ghcr.io/${{ github.repository }}:latest
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
# Buildx for caching
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ghcr.io/${{ github.repository }}:latest
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
release-book-website:
|
|
needs: build-and-push-image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up git repository
|
|
uses: actions/checkout@v3
|
|
- name: Print dependency versions
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: ${{ env.LATEST_IMAGE }}
|
|
options: -v ${{ github.workspace }}:/app
|
|
run: |
|
|
cd /app/book
|
|
make show_tools_version
|
|
- name: Print build variables
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: ${{ env.LATEST_IMAGE }}
|
|
options: -v ${{ github.workspace }}:/app
|
|
run: |
|
|
cd /app/book
|
|
make printvars
|
|
- name: Bake the book
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: ${{ env.LATEST_IMAGE }}
|
|
options: -v ${{ github.workspace }}:/app
|
|
run: |
|
|
cd /app/book
|
|
make -j -O bake
|
|
- name: Copy book to downloads server
|
|
uses: burnett01/rsync-deployments@7.0.2
|
|
with:
|
|
switches: "-avzr"
|
|
remote_host: ${{ secrets.SSH_HOST }}
|
|
remote_user: ${{ secrets.SSH_USERNAME }}
|
|
remote_key: ${{ secrets.SSH_KEY }}
|
|
path: "book/release/*"
|
|
remote_path: "~/downloads/the-sourdough-framework/"
|
|
- name: Upload book artifacts to GitHub
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: books
|
|
path: |
|
|
book/book_serif/book.log
|
|
book/book_serif/book.pdf
|
|
book/book-epub/book.epub
|
|
- name: Copy website to downloads server
|
|
uses: burnett01/rsync-deployments@7.0.2
|
|
with:
|
|
switches: "-avzr --delete"
|
|
remote_host: ${{ secrets.SSH_HOST }}
|
|
remote_user: ${{ secrets.SSH_USERNAME }}
|
|
remote_key: ${{ secrets.SSH_KEY }}
|
|
path: "website/static_website_html/*"
|
|
remote_path: "~/the-sourdough-framework/"
|
|
- name: Upload website artifacts to GitHub
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: website
|
|
path: website/static_website_html |