|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: How to automatically publish the HTML of my contribution to a website? |
| 4 | +date: 2025-03-20T15:30:00.000Z |
| 5 | +categories: reproducibility |
| 6 | +description: Describe how to render your article, activate your gh-page and publish your contribution online |
| 7 | +--- |
| 8 | + |
| 9 | +# TL;DR |
| 10 | + |
| 11 | +After cloning the right template for you (R, Python, or both), verify the `.github/workflows/build.yml`, it should contain exactly what is on the [Computo Workflow repository's `build.yml`](https://github.com/computorg/workflows/blob/main/.github/workflows/build.yml) : |
| 12 | + |
| 13 | +``` yaml |
| 14 | +name: Main Workflows |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: ["main","master"] |
| 19 | + repository_dispatch: |
| 20 | + types: [custom-event] |
| 21 | + workflow_dispatch: |
| 22 | + pull_request: |
| 23 | + branches: ["main","master"] |
| 24 | + |
| 25 | +jobs: |
| 26 | + call_env_workflow: |
| 27 | + uses: computorg/workflows/.github/workflows/global-env.yml@main |
| 28 | + call_quartopublish_workflow: |
| 29 | + uses: computorg/workflows/.github/workflows/publish-render.yml@main |
| 30 | + needs: call_env_workflow |
| 31 | +``` |
| 32 | +
|
| 33 | +Second, in your `Settings > Pages` on your repository, select the **GitHub Actions** as the source of your website. |
| 34 | + |
| 35 | +{:width="100%"} |
| 36 | + |
| 37 | +Then, you can customize the `setup-env-ci.sh` and `setup-render-ci.sh` scripts to fit your needs. |
| 38 | +- `setup-env-ci.sh` is for setting up the environment and typically adding system dependencies. The virtual machine on github (runner) may need to install some packages with `apt-get` for R or Python packages. |
| 39 | +- `setup-render-ci.sh` is for taking care of specific dependencies outside of quarto, related to rendering, like plotting software or running a script to generate data. |
| 40 | + |
| 41 | +> **Note** |
| 42 | +> |
| 43 | +> You can safely delete the `gh-pages` branch if you have one, as we don't need anymore to push the HTML files to the site. |
| 44 | + |
| 45 | +# Computo Workflow Structure |
| 46 | + |
| 47 | +The Computo workflows provide a streamlined publishing pipeline for authors to submit and render Quarto articles directly on GitHub Pages without requiring technical expertise. |
| 48 | + |
| 49 | +## Workflow Summary |
| 50 | + |
| 51 | +{:width="100%"} |
| 52 | + |
| 53 | +The publication process consists of two main phases: |
| 54 | + |
| 55 | +1. **Environment Setup and Caching** (`global-env.yml`) |
| 56 | + - Detects and installs required dependencies (Python, R) |
| 57 | + - Caches the environment for faster subsequent runs |
| 58 | + - Customizable via `setup-env-ci.sh` |
| 59 | +2. **Rendering and Deployment** (`publish-render.yml`) |
| 60 | + - Renders Quarto documents to HTML |
| 61 | + - Publish the output to GitHub Pages |
| 62 | + - Customizable via `setup-render-ci.sh` |
| 63 | + |
| 64 | +Authors only need to reference the main workflow file (`build.yml`) in their repository, which orchestrates these processes. |
| 65 | + |
| 66 | +## Workflow Visualization |
| 67 | + |
| 68 | +## Key Benefits |
| 69 | + |
| 70 | +- **Simplified Process**: Authors need minimal GitHub Actions knowledge |
| 71 | +- **Optimized Performance**: Environment caching for faster builds |
| 72 | +- **Customization Points**: Two script entry points for custom configurations |
| 73 | +- **Automated Deployment**: Direct publishing to GitHub Pages |
| 74 | + |
| 75 | +Authors simply use the build.yml workflow in their repository to trigger the complete process from environment setup to final publication. |
0 commit comments