Skip to content

Commit 334f35c

Browse files
authored
Merge pull request #186 from carpentries/transition-custom-workflows
add note about how to preserve custom workflows
2 parents e318410 + 5aec55f commit 334f35c

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

learners/migrating-from-styles.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ It is sufficient to create an empty file, named appropriately. This is available
8888
bash add-lesson.sh carpentries-incubator/YOUR-LESSON-NAME
8989
```
9090
91-
But you may wish to populate this script with some function calls to clean up various common artifacts produced by the transition. Look at the `.R` scripts in the [`carpentries-incubator/`](https://github.com/carpentries/lesson-transition/tree/main/carpentries-incubator), [`datacarpentry`](https://github.com/carpentries/lesson-transition/tree/main/datacarpentry), [`librarycarpentry`](https://github.com/carpentries/lesson-transition/tree/main/librarycarpentry), and [`swcarpentry`](https://github.com/carpentries/lesson-transition/tree/main/swcarpentry) directories of the `lesson-transition` repository for inspiration.
91+
But you may wish to populate this script with some function calls to clean up various common artifacts produced by the transition, or to preserve any [custom workflows](#custom-workflows) you have added to your lesson repository. Look at the `.R` scripts in the [`carpentries-incubator/`](https://github.com/carpentries/lesson-transition/tree/main/carpentries-incubator), [`datacarpentry`](https://github.com/carpentries/lesson-transition/tree/main/datacarpentry), [`librarycarpentry`](https://github.com/carpentries/lesson-transition/tree/main/librarycarpentry), and [`swcarpentry`](https://github.com/carpentries/lesson-transition/tree/main/swcarpentry) directories of the `lesson-transition` repository for inspiration.
9292
9393
### 3. Run the transition tool{#transition}
9494
@@ -125,7 +125,6 @@ Try running the process step-by-step:
125125
if [ ! -s ../$LESSONNAME-invalid.hash ]; then rm ../$LESSONNAME-invalid.hash;fi
126126
```
127127
2. Adjust lesson config file
128-
* record lesson creation date in config.yaml: run `git log` and hit <kbd>Shift+G</kbd> to jump to end of file, note down the date when the first commit was made. Then, using your favourite text editor, open `config.yaml` and modify the `created` field by replacing `~` with this creation date in YYYY-MM-DD format.
129128
* **Option 1 (manual):** Using your favourite text editor, open the `config.yaml` file and remove the lines setting the `workbench-beta`, `analytics`, `lang`, and `url` parameters.
130129
* **Option 2 (using regular expressions):** In Bash, run:
131130
@@ -138,6 +137,14 @@ Try running the process step-by-step:
138137
git remote set-url origin ADDRESS-OF-YOUR-REMOTE # replace ADDRESS-OF-YOUR-REMOTE to set origin to the correct address for your lesson repository on GitHub
139138
```
140139
140+
::: callout
141+
142+
### Custom workflow files{#custom-workflows}
143+
The contents of the `.github` folder are not preserved by the transition tool. If you had any custom workflow files in your lesson repository before migrating to the new infrastructure, you will need to add those back into `.github/workflows/` at this point then commit the changes. (You could also modify the Rscript for your lesson transition to do this for you, and repeat the transition process to include it.)
144+
145+
:::
146+
147+
141148
#### Build and check your transitioned lesson
142149
At this stage, the `release/carpentries-incubator/YOUR-LESSON-NAME/` directory should contain a transitioned version of your lesson.
143150
To check how things are looking, [install the Workbench tools for your system](index.html#installation), then open R in this directory and run `sandpaper::serve()`.
@@ -146,7 +153,6 @@ To check how things are looking, [install the Workbench tools for your system](i
146153
While previewing this transitioned lesson site, you might see some problems in the content of your lesson site that appeared during the migration. Liquid comments (delineated by `{% comment %}` and `{% endcomment %}` tags) are one commonly-encountered artifact. Another is broken links to the lesson setup instructions, which are found at `index.html#setup` in a Workbench site. These can be fixed by editing the lesson after transition, but for a cleaner commit history on your lesson you might wish to delete the transitioned lesson directory (inside the `release` folder), modify the R script for your lesson to handle those issues, and re-run the transition tool. (See [_Create an Rscript for your lesson_](#Rscript) above.)
147154
148155
#### If something goes wrong
149-
150156
To go back to the start and try again, delete the directory for your lesson within the `release/` directory, i.e. `rm -rf release/carpentries-incubator/YOUR-LESSON-NAME`.
151157
152158
If the transition tool ran successfully but your lesson build fails, this is usually due to customisations made to the lesson that fall outside what the transition tool expected to find.
@@ -160,17 +166,19 @@ If something goes wrong and you cannot debug the problem on your own, post a mes
160166
**We recommend that you try these steps out on a fork of your lesson first**, so that you can be certain everything works before making permanent changes to your main lesson repository.
161167
:::
162168
163-
1. Commit the changes you made to the lesson config file:
169+
1. Record your lesson creation date in config.yaml: run `git log` and hit <kbd>Shift+G</kbd> to jump to end of file, note down the date when the first commit was made. Then, using your favourite text editor, open `config.yaml` and modify the `created` field by replacing `~` with this creation date in YYYY-MM-DD format.
170+
171+
2. Commit the changes you made to the lesson config file:
164172
165173
```bash
166174
git add config.yaml
167175
git commit -m 'complete configuration of Workbench lesson site'
168176
```
169177
170-
2. Rename the branches of your project:
178+
3. Rename the branches of your project:
171179
- On your GitHub repository, rename the `gh-pages` branch to `legacy/gh-pages` (if `main` is your default branch, also rename that to `legacy/main`).
172180
- Branches can be renamed by going to the list of all branches on your repository (add `/branches/all` to the end of the URL for your GitHub repository e.g. <https://github.com/datacarpentry/image-processing/branches/all>) and selecting the pencil icon button next to the relevant branch in that listing.
173-
3. In Bash on your local system (make sure you are working in the root of the `release/carpentries-incubator/YOUR-LESSON-NAME` directory), run the following commands (please read the comments that annotate these commands and note that **we strongly recommend that you execute these one-at-a-time!**):
181+
4. In Bash on your local system (make sure you are working in the root of the `release/carpentries-incubator/YOUR-LESSON-NAME` directory), run the following commands (please read the comments that annotate these commands and note that **we strongly recommend that you execute these one-at-a-time!**):
174182
175183
```bash
176184
git remote -v # check the names and addresses of your remote repositories: if you are testing on a fork and it is not listed here, add it with 'git remote add' https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emaddem
@@ -185,14 +193,14 @@ If something goes wrong and you cannot debug the problem on your own, post a mes
185193
git push --force origin HEAD:gh-pages
186194
```
187195
188-
4. If everything has gone well up to this point, it is time to go back to the `main` branch and force push its contents to GitHub:
196+
5. If everything has gone well up to this point, it is time to go back to the `main` branch and force push its contents to GitHub:
189197
190198
```bash
191199
git switch main
192200
git push --force --set-upstream origin main # force push the transitioned main branch to your GitHub repository
193201
```
194202
195-
5. On your GitHub repository:
203+
6. On your GitHub repository:
196204
- set the default branch to `main` (in Settings->General, click the button with two arrows next to the name of the default branch)
197205
- in Settings->Branches, add rules to protect the `main` branch (require pull requests) and lock `legacy/*`
198206
- make sure that your lesson site is being served with GitHub Pages from the root folder of the gh-pages branch (in Settings->Pages, under _Build and deployment_, ensure that `gh-pages` is selected with the dropdown under _Branch_ and that `/ (root)` is the folder selected, then hit the _Save_ button)

0 commit comments

Comments
 (0)