-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (138 loc) · 5.85 KB
/
bump-ebuilds.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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: 'bump ebuilds'
on:
workflow_dispatch:
schedule:
- cron: '17 5 * * *' # @Daily
jobs:
find-updates:
outputs:
skip: ${{ steps.generate-matrix.outputs.skip }}
matrix: ${{ steps.generate-matrix.outputs.matrix }}
checked: ${{ steps.generate-matrix.outputs.checked }}
all: ${{ steps.generate-matrix.outputs.all }}
GLPlugin: ${{ steps.generate-matrix.outputs.GLPlugin }}
runs-on: ubuntu-latest
container:
image: ghcr.io/antonfischl1980/gentoo-ci:main
steps:
- name: Checkout code
uses: actions/checkout@v4
# emerge --sync not needed in this run
- name: repos.conf/icinga
run: |
mkdir -p /etc/portage/repos.conf/
echo -en "[icinga]\nlocation = " >/etc/portage/repos.conf/icinga.conf
pwd -P >> /etc/portage/repos.conf/icinga.conf
cat /etc/portage/repos.conf/*.conf
# Find all packages that have "github" upstream
# then compare local version with latest remote version tag
- name: find updates hosted on github
run: |
.github/bin/find-updates.sh
- name: generate matrix of bumps
id: generate-matrix
run: |
if [ -r /todo.lst ]; then
echo "xxxxxxxxxxxxxxxxxxxxx"
echo "Todo:"
cat /todo.lst
echo -n "::set-output name=matrix::"
jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))' /todo.lst
else
echo "::set-output name=skip::true"
fi
echo -n "::set-output name=checked::"
jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))' /checked.lst
equery l -o "*::icinga" --format='$category/$name' | grep -Evf .github/bin/find-updates.dont_check | sort -u >/all.lst
echo -n "::set-output name=all::"
jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))' /all.lst
if [ -r /GLPlugin.version ]; then
echo -n "::set-output name=GLPlugin::"
cat /GLPlugin.version
fi
- name: verify matrix
run: |
echo "skip: ${{ steps.generate-matrix.outputs.skip }}"
echo "matrix: ${{ steps.generate-matrix.outputs.matrix }}"
echo "GLPlugin: ${{ steps.generate-matrix.outputs.GLPlugin }}"
bump-ebuild:
needs: find-updates
if: ${{ !needs.find-updates.outputs.skip }}
runs-on: ubuntu-latest
container:
image: ghcr.io/antonfischl1980/gentoo-ci:main
strategy:
matrix:
bump: ${{ fromJSON(needs.find-updates.outputs.matrix) }}
steps:
- name: verify variables
run: |
echo "bump: ${{ matrix.bump }}"
- name: Checkout code
uses: actions/checkout@v4
# https://github.com/peter-evans/create-pull-request/issues/1170
- name: Bug workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: repos.conf/icinga
run: |
mkdir -p /etc/portage/repos.conf/
echo -en "[icinga]\nlocation = " >/etc/portage/repos.conf/icinga.conf
pwd -P >> /etc/portage/repos.conf/icinga.conf
cat /etc/portage/repos.conf/*.conf
- name: bump ebuild
run: |
PACKAGE_NAME="$(echo "${{ matrix.bump }}"|sed -E 's#-[^-]+$##')"
NEW_VERSION="${{ matrix.bump }}"
LATEST_EBUILD="$(equery l -o "$PACKAGE_NAME::icinga" --format='$category/$name/$name-$fullversion.ebuild'|tail -1)"
NEW_EBUILD="$PACKAGE_NAME/$(echo "$NEW_VERSION"|sed -E 's#^[^/]+/##').ebuild"
echo "PACKAGE_NAME: $PACKAGE_NAME"
echo "NEW_VERSION: $NEW_VERSION"
echo "NEW_EBUILD: $NEW_EBUILD"
echo "LATEST_EBUILD: $LATEST_EBUILD"
cp -a "$LATEST_EBUILD" "$NEW_EBUILD"
echo "XXXXXXXXXXXXXXXXXX"
cat "$NEW_EBUILD"
echo "XXXXXXXXXXXXXXXXXX"
# Check if perl-module
grep -q "^inherit.*perl-module" "$NEW_EBUILD" && (
# initialize cpan
cpan </dev/null >/dev/null 2>&1
REMOTE_NAME="$(grep cpan-module "${PACKAGE_NAME}/metadata.xml" |head -1|sed -E 's#^.*>(([a-zA-Z]+::)+[a-zA-Z]+)<.*$#\1#')"
echo "REMOTE_NAME: ${REMOTE_NAME}"
REMOTE_AUTHOR="$(cpan -D "${REMOTE_NAME}"|awk -F / '/.tar.gz$/{print $3}')"
echo "REMOTE_AUTHOR: ${REMOTE_AUTHOR}"
sed --in-place -E 's#^DIST_AUTHOR=.*#DIST_AUTHOR="'${REMOTE_AUTHOR}'"#g' "$NEW_EBUILD"
sed --in-place -E 's#^DIST_VERSION=.*#DIST_VERSION="'${NEW_VERSION}'"#g' "$NEW_EBUILD"
) || echo "not CPAN"
# Special case dev-perl/GLPlugin
if [ "${PACKAGE_NAME}" == "dev-perl/GLPlugin" ];then
REMOTE_COMMIT="$( echo "${{ needs.find-updates.outputs.GLPlugin }}" )"
echo "REMOTE_COMMIT: ${REMOTE_COMMIT}"
sed --in-place -E 's/COMMIT=.*/COMMIT="'${REMOTE_COMMIT}'"/g' "$NEW_EBUILD"
fi
ekeyword ~all "$NEW_EBUILD"
# Update Copyright & EAPI=7 => EAPI=8 (mostly compatible)
sed --in-place -E '1s/Copyright [0-9-]+/Copyright 1999-2024/; s/^(EAPI=.*)7(.*)/\18\2/' "$NEW_EBUILD"
ebuild "$NEW_EBUILD" manifest
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: '[ bump-ebuilds ] ${{ matrix.bump }}'
body: 'automated bump from .github/workflows/bump-ebuilds.yml'
commit-message: 'bump ${{ matrix.bump }}'
branch: ${{ matrix.bump }}
assignees: antonfischl1980
delete-branch: true
list-non-checked:
needs: find-updates
runs-on: ubuntu-latest
steps:
- name: verify variables
run: |
echo '${{ needs.find-updates.outputs.checked }}' |jq -r '.[]'|sort -u > checked.lst
cat checked.lst
echo '${{ needs.find-updates.outputs.all }}' |jq -r '.[]'|sort -u > all.lst
cat all.lst
- name: list of not checked packages
run: |
diff checked.lst all.lst | awk '/^>/{print $2}'