|
27 | 27 |
|
28 | 28 | This section of code basically means it will only run when a push is made to the master branch and one of the file types is a .mlx file. If not .mlx files are pushed, we don’t continue.
|
29 | 29 |
|
30 |
| - |
| 30 | +``` |
| 31 | +jobs: |
| 32 | + copy-changes: |
| 33 | + runs-on: self-hosted |
| 34 | + steps: |
| 35 | + - name: Checkout Source Repo |
| 36 | + uses: actions/checkout@v2 |
| 37 | + with: |
| 38 | + repository: 'openCOBRA/COBRA.tutorials' |
| 39 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + fetch-depth: 0 |
| 41 | +``` |
31 | 42 |
|
32 | 43 |
|
33 | 44 | - Next, we have a series of ‘jobs’ to compute.
|
34 | 45 | - The ‘runs-on’ parameter indicates where these jobs are computed. Here I specify it runs on ‘self-hosted’ because we need Matlab on King to run the .mlx to html. Generally, I would avoid using a self-hosted server but since Matlab is not an opensource programming language it needs to be ran a computer which has Matlab installed with a license.
|
35 | 46 | - There are several steps to do in the jobs section. Here the first step is to checkout the source repo i.e. get all the details about the repo and the pushes made to the repo.
|
36 | 47 |
|
37 |
| - |
| 48 | +``` |
| 49 | +- name: Get All Changed Files |
| 50 | + id: files |
| 51 | + uses: jitterbit/get-changed-files@v1 |
| 52 | +
|
| 53 | +- name: Find changed files |
| 54 | + id: getfile |
| 55 | + run: | |
| 56 | + files=$(echo "${{ steps.files.outputs.all }}" | tr ' ' '\n' | grep -E '\.mlx$') |
| 57 | + echo "::set-output name=file::$files" |
| 58 | +``` |
38 | 59 |
|
39 | 60 |
|
40 | 61 | - Here we have two more steps. The first step in this picture is used to find all the files that have been changed based on the most recent push.
|
41 | 62 | - The next step is then used to find all the .mlx files that were pushed to the repository.
|
42 | 63 |
|
43 |
| - |
| 64 | +``` |
| 65 | + - name: Give execute permission to the script |
| 66 | + run: chmod +x build.sh |
| 67 | + |
| 68 | + - name: Give execute permission to the other script |
| 69 | + run: chmod +x setup.sh |
| 70 | +``` |
44 | 71 |
|
45 | 72 |
|
46 | 73 | The chmod command just makes the .sh files executable.
|
|
0 commit comments