-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (56 loc) · 2.01 KB
/
compile.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
56
57
58
name: Compile Artifacts
on:
workflow_call:
inputs:
recompile:
required: false
type: string
jobs:
compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: Check changed files for SCSS
id: compile_scss
if: ${{ ! inputs.recompile }}
run: |
for f in $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }}); do
if [[ "$f" == *".scss" ]]; then
echo "SCSS=true" >> "$GITHUB_OUTPUT"
break
fi
done
- name: Check inputs for SCSS
id: recompile_scss
if: ${{ endsWith(inputs.recompile, '.scss') }}
run: echo "SCSS=true" >> "$GITHUB_OUTPUT"
- name: Conditionally install dart-sass
if: steps.recompile_scss.outputs.SCSS == 'true' || steps.compile_scss.outputs.SCSS == 'true'
run: |
curl --silent --show-error --location https://github.com/sass/dart-sass/releases/download/${{ vars.DART_SASS_VERSION }}/dart-sass-${{ vars.DART_SASS_VERSION }}-linux-x64.tar.gz | tar --extract --gzip
mv dart-sass/sass /usr/local/bin
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Compile artifacts from changed files
if: ${{ ! inputs.recompile }}
env:
GROUPS: ${{ secrets.LIBGUIDES_GROUPS }}
run: for f in $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }});
do
python .github/workflows/compile.py "$f";
done
- name: Recompile artifact from input
if: ${{ inputs.recompile }}
env:
GROUPS: ${{ secrets.LIBGUIDES_GROUPS }}
run: python .github/workflows/compile.py ${{ inputs.recompile }};
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: compile-${{ github.sha }}
path: artifacts