-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (82 loc) · 2.55 KB
/
cleanup-packages.yaml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: cleanup/packages
run-name: ${{
format(
'[{0}] cleanup/packages',
(github.event_name == 'pull_request' && format('pr/{0}', github.event.number)) ||
github.event_name
)
}}
on:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
pull_request:
types:
- closed
branches:
- main
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
schedule:
- cron: '23 5 * * *'
jobs:
debug:
name: Show Debug Info
runs-on: ubuntu-latest
permissions: {}
steps:
- id: show_debug_info
name: Show Debug Info
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
# Show Debug Info
echo "::group::User Info"
id
echo "::endgroup::"
echo "::group::GitHub Context"
echo "${GITHUB_CONTEXT}"
echo "::endgroup::"
echo "::group::Environment Variables"
unset GITHUB_CONTEXT
env | sort
echo "::endgroup::"
echo "::group::Git Info"
which git
git --version
echo "::endgroup::"
cleanup:
runs-on: ubuntu-latest
steps:
- id: setup_micromamba
name: Create Python Environment
# https://github.com/mamba-org/setup-micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
cache-environment: true
condarc: |
channels:
- conda-forge
- energy-quants
environment-name: cleanup
create-args: >-
eq-devtools>=0.6.0
ruamel.yaml>=0.17.32,<0.18
- id: cleanup_packages
name: Cleanup Packages
shell: bash -l {0}
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.CI_PACKAGES }}
run: |
set -euox pipefail
devtool --version
packages=$(
devtool github packages list --owner 'energy-quants' --json \
| jq -r '.[] | select(.repository.full_name == "energy-quants/eq-devtools") | .name'
)
for package in $packages; do
# devtool github packages list-versions --owner 'energy-quants' --package "${package}"
devtool github packages cleanup --owner 'energy-quants' --package "${package}" --max-age=-1
done