|
7 | 7 | - "environment.yml" |
8 | 8 | - "dependencies.R" |
9 | 9 | - ".github/workflows/blog.yaml" |
| 10 | + workflow_dispatch: |
10 | 11 |
|
11 | 12 | jobs: |
12 | 13 | blog: |
13 | 14 | runs-on: ubuntu-latest |
| 15 | + defaults: |
| 16 | + run: |
| 17 | + shell: bash -l {0} |
| 18 | + env: |
| 19 | + RETICULATE_PYTHON: /usr/share/miniconda3/envs/www-main/bin/python |
14 | 20 | steps: |
15 | 21 | - uses: actions/checkout@v3 |
16 | 22 | with: |
17 | 23 | # submodules: true # Fetch Hugo themes (true OR recursive) |
18 | 24 | fetch-depth: 3 |
19 | | - - name: Cache Conda |
20 | | - |
21 | | - with: |
22 | | - path: ~/conda_pkgs_dir |
23 | | - key: ${{ runner.os }}-conda6-${{ hashFiles('environment.yml') }} |
24 | | - restore-keys: | |
25 | | - ${{ runner.os }}-conda6- |
26 | 25 | - uses: conda-incubator/setup-miniconda@v2 |
27 | 26 | with: |
28 | 27 | python-version: 3.9 |
29 | | - mamba-version: "*" |
30 | | - channels: conda-forge,defaults |
31 | | - channel-priority: true |
32 | 28 | activate-environment: www-main |
33 | | - environment-file: environment.yml |
34 | | - auto-activate-base: false |
| 29 | + miniforge-variant: Mambaforge |
| 30 | + miniforge-version: latest |
| 31 | + use-mamba: true |
35 | 32 | use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! |
36 | | - # - name: Conda info |
37 | | - # shell: bash -l {0} |
38 | | - # run: | |
39 | | - # conda info |
40 | | - # conda list |
| 33 | + - name: Get Date |
| 34 | + id: get-date |
| 35 | + run: echo "name=today::$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT |
| 36 | + shell: bash |
| 37 | + - name: Cache Conda env |
| 38 | + uses: actions/cache@v3 |
| 39 | + with: |
| 40 | + path: ${{ env.CONDA }}/envs |
| 41 | + key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER }} |
| 42 | + env: |
| 43 | + # Increase this value to reset cache if etc/example-environment.yml has not changed |
| 44 | + CACHE_NUMBER: 0 |
| 45 | + id: cache |
| 46 | + - name: Update environment |
| 47 | + run: mamba env update -n www-main -f environment.yml |
| 48 | + if: steps.cache.outputs.cache-hit != 'true' |
| 49 | + - name: Conda info |
| 50 | + run: | |
| 51 | + conda info |
| 52 | + conda list |
41 | 53 | - name: Install R dependencies |
42 | | - shell: bash -l {0} |
43 | 54 | env: |
44 | 55 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
45 | 56 | run: | |
|
54 | 65 | ${{ runner.os }}-blogdown2-${{ hashFiles('environment.yml') }}- |
55 | 66 | ${{ runner.os }}-blogdown2- |
56 | 67 | - name: Build site |
57 | | - shell: bash -l {0} |
58 | 68 | run: | |
59 | 69 | npm run build:blog |
60 | | -
|
61 | 70 | - uses: actions/upload-artifact@v3 |
62 | 71 | with: |
63 | 72 | name: blog |
|
79 | 88 | run: npm run lint |
80 | 89 | - name: Build |
81 | 90 | run: npm run build |
82 | | - |
83 | 91 | - uses: actions/upload-artifact@v3 |
84 | 92 | with: |
85 | 93 | name: website |
|
0 commit comments