update-conda-lockfiles #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-conda-lockfiles | |
on: | |
schedule: # quarterly | |
- cron: "0 09 1 */3 *" | |
push: | |
paths: | |
- 'conda/environment.yaml' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
lock: | |
runs-on: ${{ matrix.config.os }} | |
name: lock-${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macOS-11, slug: 'macos', shell: 'bash -l {0}'} | |
- {os: ubuntu-22.04, slug: 'linux', shell: 'bash -l {0}'} | |
- {os: windows-2022, slug: 'win', shell: 'cmd /C CALL {0}'} | |
defaults: | |
run: | |
shell: ${{ matrix.config.shell }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
environment-file: conda/environment.yaml | |
activate-environment: wflow-env | |
- name: Export lockfile | |
run: conda list --explicit --md5 > conda/environment-${{ matrix.config.slug }}.lock | |
- name: Commit lockfile | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
git pull origin main | |
git add conda/environment-${{ matrix.config.slug }}.lock | |
git commit --allow-empty -m "Update lockfile for ${{ matrix.config.slug }}" | |
git push origin main |