-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 2.16 KB
/
autoupdate.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
name: Autoupdate
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
defaults:
run:
shell:
bash -el {0}
jobs:
check_update:
name: Check if newer version exists
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Conda env
uses: mamba-org/provision-with-micromamba@268cc19728703111bda67eb6e7328258ff6eb8b6
with:
environment-name: check-env
- name: Find latest version
id: versions
run: |
pkgname="$(yq '.dependencies[0]' environment.yml | grep -Eio '[a-z0-9_-]+' | head -n 1)"
old_version=$(micromamba list -n check-env "$pkgname" --json | jq -r '.[0].version')
micromamba update -y -n check-env -a
new_version=$(micromamba list -n check-env "$pkgname" --json | jq -r '.[0].version')
if [[ "$new_version" != "$old_version" ]]; then
sed -i "s/$old_version/$new_version/g" environment.yml
echo "pkgname=$pkgname" >> "$GITHUB_OUTPUT"
echo "new-version=$new_version" >> "$GITHUB_OUTPUT"
fi
- uses: peter-evans/create-pull-request@0dfc93c1049996241252d9dc45a270b7c12dec6b
if: steps.versions.outputs.pkgname
with:
commit-message: "Update ${{ steps.versions.outputs.pkgname }} to ${{ steps.versions.outputs.new-version }}"
title: "Update ${{ steps.versions.outputs.pkgname }} to ${{ steps.versions.outputs.new-version }}"
body: |
A new release of ${{ steps.versions.outputs.pkgname }} was detected on conda-forge.
This PR updates ${{ steps.versions.outputs.pkgname }} to version ${{ steps.versions.outputs.new-version }}.
**After merging, please manually create and push a ${{ steps.versions.outputs.new-version }} tag:**
```
bash -xc 'tmp=$(mktemp -d) && git clone ${{ github.server_url }}/${{ github.repository }} $tmp && cd $tmp && git tag ${{ steps.versions.outputs.new-version }} && git push --tags'
```
branch: v${{ steps.versions.outputs.new-version }}
delete-branch: true