-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'deploy-preview' of https://github.com/appliedepi/epiRha…
…ndbook_eng into deploy-preview
- Loading branch information
Showing
4 changed files
with
590 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Development Process for Action Workflow | ||
This document outlines the steps and processes involved in developing and maintaining the action workflow for updating translations and deploying changes in the EpiRhandbook repository. | ||
|
||
## Overview | ||
The workflow consists of five main steps, which are executed using GitHub Actions. The process starts with updating content in the English version of the handbook and ends with rendering and deploying the book. The following sections detail each step of the workflow. | ||
|
||
![Workflow description](Workflow.png) | ||
|
||
|
||
|
||
|
||
### 1. Create a new branch | ||
|
||
The English version is the standard language, and changes are always made in the English version first, then adapted to other languages. First, create a new branch based on the `deploy-preview` branch following this name pattern `handbook_v*_en`, such as `handbook_v2.1.1_en`. | ||
|
||
```sh | ||
# Fetch the latest updates from the remote repository | ||
git fetch origin | ||
|
||
# Check out the master branch | ||
git checkout master | ||
|
||
# Pull the latest changes from the remote master branch | ||
git pull origin master | ||
|
||
# Create a new branch based on the master branch | ||
# Replace 'v2.1.1' with the appropriate version number | ||
git checkout -b handbook_v2.1.1_en | ||
|
||
# Push the new branch to the remote repository | ||
git push origin handbook_v2.1.1_en | ||
``` | ||
|
||
### 2. Implement changes in the English version | ||
|
||
Open file `index.qmd` and edit some text, i.e. update the number of users. Then commit and push the changes to the remote repository. | ||
|
||
```sh | ||
# Add all changes to the staging area | ||
git add . | ||
|
||
# Commit the changes with detail message | ||
git commit -m "Update number of user" | ||
|
||
# Push the changes to the remote repository | ||
git push origin handbook_v2.1.1_en | ||
|
||
``` | ||
|
||
Open file `basic.qmd` and add a new code block for basic function in the `Simple functions` section. | ||
|
||
```r | ||
log10(1000) | ||
``` | ||
|
||
Then commit and push the changes to the remote repository. | ||
|
||
```sh | ||
# Add all changes to the staging area | ||
git add . | ||
|
||
# Commit the changes with detail message | ||
git commit -m "Add an example of simple function in R" | ||
|
||
# Push the changes to the remote repository | ||
git push origin handbook_v2.1.1_en | ||
|
||
``` | ||
|
||
### 3. Update Translation Job | ||
|
||
Github Action file: `create_pr_on_pr.yml` | ||
|
||
Whenever a change is committed and pushed from the EN branch, the Github Action will create a PR for each language version and update them. The PR is intended to be merged into the `deploy-preview` branch. The author in charge for the language version will also receive email for every new change made in the EN branch | ||
|
||
Each PR will have checkboxes for each commit of the English PR (and links to those commits). The checkboxes are to help the language lead author and the coordinator track their work before they merge to the `deploy-preview` branch. | ||
|
||
### 4. Build & Deploy Job | ||
|
||
Github Action file: `render_book_on_pr.yml` | ||
|
||
Intended branch to merge: `deploy-preview` | ||
|
||
Authors of language versions will checkout the according branch, review the PR and merge the PR into the deploy-preview branch. It will trigger the Github Action for build and deploying (`render_book_on_pr.yml`). | ||
|
||
### 5. Preview changes and merge to Main branch | ||
|
||
Intended branch to merge: `master` | ||
|
||
The coordinator preview changes in the Netlify site associated with the repo, make sure all changes made in the EN version are updated to the language version. Then open a new PR and merge the `deploy-preview` branch into the `master` branch to update the official version | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ on: | |
pull_request_target: | ||
types: [closed] | ||
branches: | ||
- master | ||
- deploy-preview | ||
|
||
jobs: | ||
setup-environment-packages: | ||
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'handbook_v') | ||
render-and-commit: | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'deploy-preview' && startsWith(github.event.pull_request.head.ref, 'handbook_v') | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
env: | ||
|
@@ -20,6 +20,13 @@ jobs: | |
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: deploy-preview | ||
|
||
- name: Fetch latest changes | ||
run: | | ||
git fetch origin | ||
git reset --hard origin/deploy-preview | ||
- name: Set up R | ||
uses: r-lib/actions/setup-r@v2 | ||
|
@@ -40,52 +47,55 @@ jobs: | |
with: | ||
cache-version: 2 | ||
|
||
# - name: Install Bioconductor packages | ||
# run: | | ||
# Rscript -e 'install.packages("babelquarto", repos = c("https://ropensci.r-universe.dev", "https://cloud.r-project.org"))' | ||
# Rscript -e 'install.packages("babeldown", repos = c("https://ropensci.r-universe.dev", "https://cloud.r-project.org"))' | ||
# Rscript -e 'renv::snapshot()' | ||
|
||
- name: Install quarto | ||
uses: quarto-dev/quarto-actions/setup@v2 | ||
with: | ||
version: 1.4.550 | ||
|
||
# - name: Print packages | ||
# run: Rscript -e 'names(installed.packages()[,3])' | ||
|
||
# - name: Render the book | ||
# # uses: quarto-dev/quarto-actions/render@v2 | ||
# run: Rscript -e 'source("quarto_runfile.R")' | ||
- name: Fix locale | ||
run: | | ||
export LANG=en_US.UTF-8 | ||
export LC_CTYPE=en_US.UTF-8 | ||
export LC_ALL=en_US.UTF-8 | ||
export LC_ALL=en_US.UTF-8 | ||
- name: Render the book | ||
shell: Rscript {0} | ||
run: | | ||
babelquarto::render_book() | ||
# uses: quarto-dev/quarto-actions/render@v2 | ||
run: Rscript -e 'source("quarto_runfile.R")' | ||
continue-on-error: true | ||
|
||
render-and-publish: | ||
needs: setup-environment-packages | ||
runs-on: ubuntu-latest | ||
if: success() | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
|
||
# - name: Render the book | ||
# run: Rscript -e 'library(babelquarto); babelquarto::render_book()' | ||
|
||
# render-and-publish: | ||
# needs: setup-environment-packages | ||
# runs-on: ubuntu-latest | ||
# if: success() | ||
# steps: | ||
# - name: Check out repository | ||
# uses: actions/checkout@v4 | ||
|
||
- name: Commit results to main branch | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
git add . | ||
git commit -m "CI added changes `date +'%Y-%m-%d %H:%M:%S'`" || echo "No changes to commit" | ||
git push origin || echo "No changes to commit" | ||
git push origin deploy-preview || echo "No changes to commit" | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
branch: master | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
force: true | ||
# - name: Push changes | ||
# uses: ad-m/github-push-action@master | ||
# with: | ||
# branch: main | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# force: true | ||
|
||
# - name: Publish to Netlify | ||
# uses: quarto-dev/quarto-actions/publish@v2 | ||
|
Oops, something went wrong.