Don't fail the release when the downloads server is unreachable (#475) #153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@v4 | |
| - 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@v4 | |
| - 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 | |
| # Best-effort: a temporarily unreachable downloads server must not | |
| # fail the whole release. Book/website artifacts are still uploaded | |
| # to GitHub below. | |
| continue-on-error: true | |
| uses: burnett01/rsync-deployments@v8 | |
| 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 | |
| # Best-effort, same rationale as the book deploy above. | |
| continue-on-error: true | |
| uses: burnett01/rsync-deployments@v8 | |
| 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 |