-
Notifications
You must be signed in to change notification settings - Fork 321
58 lines (45 loc) · 1.76 KB
/
convert.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: MATLAB MLX to HTML Conversion
# Trigger the workflow on push events but only for the main branch
on:
push:
branches:
- gh-pages
paths:
- '**.mlx'
# The jobs key is a collection of the jobs to run
jobs:
convert-mlx-to-html:
# The type of runner that the job will run on
runs-on: self-hosted
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Manual Repository Checkout
run: |
# Remove the cobratoolbox_repo directory if it exists, then recreate it
rm -rf cobratoolbox_repo
mkdir cobratoolbox_repo
# Clone the repository into the cobratoolbox_repo directory
git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox_repo
cd cobratoolbox_repo
- name: Get Changed MLX Files
id: getfile
run: |
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.mlx' || echo "")
echo "Changed MLX files: $changed_files"
echo "mlx_file=$changed_files" >> $GITHUB_ENV
- name: Print Changed MLX Files
if: steps.getfile.outputs.mlx_file != ''
run: echo "The following MLX files have been changed ${{ env.mlx_file }}"
- name: Make MATLAB Script Executable
run: chmod +x ./run_matlab.sh
- name: Convert MLX to HTML
if: steps.getfile.outputs.mlx_file != ''
run: |
./run_matlab.sh "${{ steps.getfile.outputs.mlx_file }}"
- name: Commit and Push New File
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add .
git commit -m "Add new HTML file" || echo "No changes to commit"
git push -f origin gh-pages