|
| 1 | +--- |
| 2 | +title: "How To Build A Workshop Package" |
| 3 | +subtitle: "In other words, how do I use what's here" |
| 4 | +author: Sean Davis^[[email protected]] |
| 5 | +output: rmarkdown::html_vignette |
| 6 | +vignette: > |
| 7 | + %\VignetteIndexEntry{How to Use this Package to Build a Bioc Workshop} |
| 8 | + %\VignetteEngine{knitr::rmarkdown} |
| 9 | + %\VignetteEncoding{UTF-8} |
| 10 | +--- |
| 11 | + |
| 12 | +First, this package doesn't do much except add a template Github Action to |
| 13 | +build all the pieces necessary for a workshop. |
| 14 | + |
| 15 | +## Quickstart |
| 16 | + |
| 17 | +- [ ] Create a repo from this template and rename it (do not fork the repository). |
| 18 | +- [ ] Edit `DESCRIPTION` file |
| 19 | + - [ ] Change package name |
| 20 | + - [ ] Change title and description |
| 21 | + - [ ] Change authors |
| 22 | + - [ ] Check dependencies |
| 23 | + - [ ] Change DockerImage tag |
| 24 | +- [ ] Edit '_pkgdown.yml' and`.github/workflows/basic_checks.yaml` |
| 25 | +- [ ] Write a normal R package that can be installed |
| 26 | +- [ ] Include one or more vignettes that will constitute the workshop materials |
| 27 | + |
| 28 | +## Details |
| 29 | + |
| 30 | +To accomplish this follow each of the 7 steps below. Once your edit the yaml files, Github actions will run each time you commit to github and it creates the pkgdown website and docker image for you. |
| 31 | + |
| 32 | +### 1. Clone this repo |
| 33 | +Clone this repo, fork and **rename** it, or create a repo from this template |
| 34 | + |
| 35 | +``` |
| 36 | +git clone https://github.com/seandavi/BuildABiocWorkshop MYPKGDIR |
| 37 | +``` |
| 38 | + |
| 39 | +### 2. Edit `DESCRIPTION` file |
| 40 | + |
| 41 | +- Change the package name to something identifiable and descriptive, ideally |
| 42 | +something that will be somewhat unique. |
| 43 | +- Edit the title and description as per any normal R package. |
| 44 | +- Update authors (unless you want me to get credit for your work). |
| 45 | +- Workshop packages are normal R packages, so dependencies work as usual. Append libraries to the Depends/Suggests/Imports in this package DESCRIPTION File, which includes; |
| 46 | + |
| 47 | +Depends: |
| 48 | + Biobase |
| 49 | +Suggests: |
| 50 | + knitr, |
| 51 | + rmarkdown, |
| 52 | + pkgdown |
| 53 | + If your packages depend on a github R repos, be sure to specify the correct repo `username/reponame`. Installation will deal with this. |
| 54 | + |
| 55 | +- Edit the last 3 lines of the DESCRIPTION FILE, URL, BugReports and DockerImage (described in more detail below) |
| 56 | + |
| 57 | +### 3. Set up a website (Github Pages) |
| 58 | + |
| 59 | +In your repository, click on settings or url https://github.com/<github username>/<workshop repos name>/settings. Midway down the page, in the GitHub Pages section, select source 'gh-pages branch'. If only 'master branch' is visible, select master for now, but once Github actions runs, 'gh-pages branch' will be available and is required to render the website. |
| 60 | + |
| 61 | +In the DESCRIPTION file, update the URL: to the website url eg https://seandavi.github.io/BuildABiocWorkshop/ |
| 62 | + |
| 63 | +### 4. Edit _pkgdown.yml |
| 64 | + |
| 65 | +Edit the file _pkgdown.yml, updating the url:, title and href: which should be your website url, title of your workshop and github repos url respectively. You do not need to edit this file further. You do not need to add menus or links to vignettes. GitHub Actions and pkgdown will do this when it builds the website |
| 66 | + |
| 67 | +### 5. Edit `.github/workflows/basic_checks.yaml` |
| 68 | + |
| 69 | +You need a dockerhub account, which if you don't have one, can be created at hub.docker.com. Your <docker user name> maybe different to your <gitub username name>. |
| 70 | + |
| 71 | +You do not need to create a docker image manually. Github actions will read Dockerfile located in this template, and using the yamls files will create, build and push to dockerhub an image with your desired name. |
| 72 | + |
| 73 | +- **You MUST change the `repository` line in this yaml file to be YOUR desired Docker image name**. |
| 74 | + |
| 75 | +- The **image name must be in lower case**. |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +```yaml |
| 81 | +on: [push, pull_request] |
| 82 | + |
| 83 | +env: |
| 84 | + cache-version: v1 |
| 85 | + # Change the following line to what you want YOUR |
| 86 | + # docker image to be called. Do not include |
| 87 | + # any tags--those will be added automatically |
| 88 | + repo-name: seandavi/buildabiocworkshop |
| 89 | +``` |
| 90 | +
|
| 91 | +In the DESCRIPTION file, the **DockerImage: should match your desired name for a dockerhub repository**. |
| 92 | +
|
| 93 | +### 6. Add "secrets" to github repo |
| 94 | +
|
| 95 | +Secrets are encrypted environment variables that you create in a |
| 96 | +repository or organization. The secrets you create are available to |
| 97 | +use in GitHub Actions workflows. GitHub uses a libsodium sealed box to |
| 98 | +help ensure that secrets are encrypted before they reach GitHub, and |
| 99 | +remain encrypted until you use them in a workflow. |
| 100 | + |
| 101 | +See [Creating and storing encrypted secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) |
| 102 | +
|
| 103 | +- `DOCKER_USERNAME`: your dockerhub username; create a dockerhub account if you do not have one |
| 104 | +- `DOCKER_PASSWORD`: your dockerhub password or an access token obtained from [Docker Hub][] |
| 105 | + |
| 106 | +[Docker Hub]: https://hub.docker.com/settings/security |
| 107 | + |
| 108 | + |
| 109 | +### 7. Edit README.md, add vignettes to vignettes folder |
| 110 | +Edit the README.md. and add one or more Rmd vignettes that will constitute the workshop materials. It is normal R package that should pass rcmdcheck::rcmdcheck(), and be installed using regular R package install commands. |
| 111 | + |
| 112 | + |
0 commit comments