forked from pypsa-meets-earth/pypsa-earth
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/pypsa-meets-earth/pypsa-earth
- Loading branch information
Showing
7 changed files
with
143 additions
and
602 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Update pinned envs | ||
|
||
on: | ||
push: | ||
paths: | ||
- envs/environment.yaml | ||
# Run every Sunday at 5:00 UTC | ||
schedule: | ||
- cron: "0 5 * * 0" | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
update-pinned-environment: | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
name: Update pinned envs | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu, macos, windows] | ||
include: | ||
- os: ubuntu | ||
suffix: "linux" | ||
- os: macos | ||
suffix: "macos" | ||
- os: windows | ||
suffix: "windows" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
activate-environment: ${{ github.event.repository.name }} | ||
environment-file: envs/environment.yaml | ||
|
||
- name: Update pinned environment per OS | ||
run: | | ||
conda env export --name ${{ github.event.repository.name }} --no-builds > envs/${{ matrix.suffix }}-pinned.yaml | ||
- name: Add SPDX header | ||
if: ${{ matrix.suffix != 'windows' }} | ||
run: | | ||
SPDX_HEADER="# SPDX-FileCopyrightText: PyPSA-Earth and PyPSA-Eur Authors\n# SPDX-License-Identifier: CC0-1.0\n" | ||
echo -e "$SPDX_HEADER" | cat - envs/${{ matrix.suffix }}-pinned.yaml > temp && mv temp envs/${{ matrix.suffix }}-pinned.yaml | ||
- name: Add SPDX header (windows) | ||
if: ${{ matrix.suffix == 'windows' }} | ||
run: | | ||
$SPDX_HEADER = "# SPDX-FileCopyrightText: PyPSA-Earth and PyPSA-Eur`r`n# SPDX-License-Identifier: CC0-1.0`r`n`r`n" | ||
$CurrentContent = Get-Content "envs/${{ matrix.suffix }}-pinned.yaml" -Raw | ||
$NewContent = $SPDX_HEADER + $CurrentContent | ||
$NewContent | Set-Content "envs/${{ matrix.suffix }}-pinned.yaml" | ||
- name: Cache environment files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.suffix }}-pinned | ||
path: envs/${{ matrix.suffix }}-pinned.yaml | ||
|
||
create-pull-request: | ||
needs: update-pinned-environment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: Prepare files for commit | ||
run: | | ||
mkdir -p envs | ||
mv linux-pinned/* envs/linux-pinned.yaml | ||
mv macos-pinned/* envs/macos-pinned.yaml | ||
mv windows-pinned/* envs/windows-pinned.yaml | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: update-pinned-environment | ||
title: "[github-actions.ci] Update pinned envs" | ||
body: "Automatically generated PR to update pinned environment files for Windows, macOS, and Linux." | ||
commit-message: "Update pinned environment files for all platforms" |
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
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
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
Oops, something went wrong.