Skip to content
This repository was archived by the owner on Jan 11, 2025. It is now read-only.

Commit 726c21e

Browse files
- stop autoupdate when no new versions are found
- reduced calls for checking tag existence when not needed (was incrementing docker pulls counter) - added debug for centos failure on autoupdate - added changelog in release notes
1 parent 1c2e31b commit 726c21e

File tree

5 files changed

+55
-14
lines changed

5 files changed

+55
-14
lines changed

.github/workflows/autoupdate.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ jobs:
1212
- uses: actions/checkout@v2
1313

1414
- name: Generate Supported Versions
15-
run: make auto-update-and-commit
15+
id: auto-update-and-commit
16+
run: echo "::set-output name=ver_updated::$(make auto-update-and-commit)"
17+
18+
- name: cancelling
19+
uses: andymckay/[email protected]
20+
if: ${{ env.VER_UPDATED == '0' }}
21+
env:
22+
VER_UPDATED=${{ steps.auto-update-and-commit.outputs.ver_updated }}
1623

1724
- name: cancelling
1825
uses: andymckay/[email protected]
@@ -256,18 +263,21 @@ jobs:
256263
id: version
257264
run: echo "::set-output name=version::$(date +'v1.%Y%m%d.%H%M%S')"
258265

259-
- name: Test with environment variables
260-
run: echo $TAG_NAME
266+
- name: Changelog
267+
uses: scottbrenner/generate-changelog-action@master
268+
id: Changelog
261269
env:
262-
TAG_NAME: ${{ steps.version.outputs.version }}
270+
REPO: ${{ github.repository }}
263271

264272
- name: Create Release
265273
id: create_release
266274
uses: actions/create-release@v1
267275
env:
268276
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
269277
with:
270-
tag_name: $TAG_NAME
271-
release_name: Release $TAG_NAME
278+
tag_name: ${{ steps.version.outputs.version }}
279+
release_name: Release ${{ steps.version.outputs.version }}
280+
body: |
281+
${{ steps.Changelog.outputs.changelog }}
272282
draft: false
273283
prerelease: false

.github/workflows/main.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,22 @@ jobs:
242242
id: version
243243
run: echo "::set-output name=version::$(date +'v1.%Y%m%d.%H%M%S')"
244244

245-
- name: Test with environment variables
246-
run: echo $TAG_NAME
245+
- name: Changelog
246+
uses: scottbrenner/generate-changelog-action@master
247+
id: Changelog
247248
env:
248-
TAG_NAME: ${{ steps.version.outputs.version }}
249+
REPO: ${{ github.repository }}
249250

250251
- name: Create Release
251252
id: create_release
252253
uses: actions/create-release@v1
253254
env:
255+
TAG_NAME: ${{ steps.version.outputs.version }}
254256
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
255257
with:
256258
tag_name: $TAG_NAME
257259
release_name: Release $TAG_NAME
260+
body: |
261+
${{ steps.Changelog.outputs.changelog }}
258262
draft: false
259263
prerelease: false

bin/docker-build.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ function build() {
2424
MINOR="$MAJOR".$(echo "$NGINX_VER" | cut -d '.' -f 2)
2525
PATCH="$NGINX_VER"
2626

27-
if [ "$FORCE" == "0" ] && [ "$(docker_tag_exists fabiocicerchia/nginx-lua "$PATCH-$OS$OS_VER")" == "0" ]; then
28-
return
27+
if [ "$FORCE" == "0" ]; then
28+
if [ "$(docker_tag_exists fabiocicerchia/nginx-lua "$PATCH-$OS$OS_VER")" == "0" ]; then
29+
return
30+
fi
2931
fi
3032

3133
SUFFIX=""

bin/docker-push.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ function push() {
2020
MINOR="$MAJOR".$(echo "$NGINX_VER" | cut -d '.' -f 2)
2121
PATCH="$NGINX_VER"
2222

23-
if [ "$FORCE" == "0" ] && [ "$(docker_tag_exists fabiocicerchia/nginx-lua "$PATCH-$OS$OS_VER")" == "0" ]; then
24-
return
23+
if [ "$FORCE" == "0" ]; then
24+
if [ "$(docker_tag_exists fabiocicerchia/nginx-lua "$PATCH-$OS$OS_VER")" == "0" ]; then
25+
return
26+
fi
2527
fi
2628

2729
[[ $(docker image ls -q fabiocicerchia/nginx-lua:"$MAJOR-$OS$OS_VER" | wc -l) -ne 0 ]] && docker push fabiocicerchia/nginx-lua:"$MAJOR-$OS$OS_VER"

bin/generate-supported-versions.sh

+24-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ fetch_latest() {
1111
curl "https://hub.docker.com/v2/repositories/library/$DISTRO/tags" > /tmp/latest.$DISTRO
1212
VER=$(cat /tmp/latest.$DISTRO | jq -rc '.results[] | select( .images[].digest == "'$DIGEST'" and .name != "latest" ) | .name' | grep -E "$FILTER" | sort -Vr | head -n 1)
1313

14+
if [ "$VER" = "" ]; then
15+
ls -lah /tmp/latest.$DISTRO
16+
cat /tmp/latest.$DISTRO
17+
curl -v "https://hub.docker.com/v2/repositories/library/$DISTRO/tags"
18+
fi
19+
1420
PAGE=2
1521
while [ "$VER" = "" -a $PAGE -lt 100 ]; do
16-
cat /tmp/latest.$DISTRO
1722
VER=$(curl "https://hub.docker.com/v2/repositories/library/$DISTRO/tags?page=$PAGE" | jq -rc '.results[] | select( .images[].digest == "'$DIGEST'" and .name != "latest" ) | .name' | grep -E "$FILTER" | sort -Vr | head -n 1)
1823
((PAGE+=1))
1924
done
@@ -33,41 +38,53 @@ if [ "${#NGINX[@]}" != "1" ]; then
3338
exit 1
3439
fi
3540

41+
sleep 5
42+
3643
VER_ALPINE=$(fetch_latest "alpine")
3744
ALPINE=("$VER_ALPINE")
3845
if [ "$VER_ALPINE" = "" ]; then
3946
echo "Wrong version count in ALPINE."
4047
exit 1
4148
fi
4249

50+
sleep 5
51+
4352
VER_AMAZONLINUX=$(fetch_latest "amazonlinux")
4453
AMAZONLINUX=("$VER_AMAZONLINUX")
4554
if [ "$VER_AMAZONLINUX" = "" ]; then
4655
echo "Wrong version count in AMAZONLINUX."
4756
exit 1
4857
fi
4958

59+
sleep 5
60+
5061
VER_CENTOS=$(fetch_latest "centos" "^\d$")
5162
CENTOS=("$VER_CENTOS")
5263
if [ "$VER_CENTOS" = "" ]; then
5364
echo "Wrong version count in CENTOS."
5465
exit 1
5566
fi
5667

68+
sleep 5
69+
5770
VER_DEBIAN=$(fetch_latest "debian" "^\d{2}\.\d{1,2}")
5871
DEBIAN=("$VER_DEBIAN")
5972
if [ "$VER_DEBIAN" = "" ]; then
6073
echo "Wrong version count in DEBIAN."
6174
exit 1
6275
fi
6376

77+
sleep 5
78+
6479
VER_FEDORA=$(fetch_latest "fedora")
6580
FEDORA=("$VER_FEDORA")
6681
if [ "$VER_FEDORA" = "" ]; then
6782
echo "Wrong version count in FEDORA."
6883
exit 1
6984
fi
7085

86+
sleep 5
87+
7188
VER_UBUNTU=$(fetch_latest "ubuntu" "^\d{2}\.\d{2}")
7289
UBUNTU=("$VER_UBUNTU")
7390
if [ "$VER_UBUNTU" = "" ]; then
@@ -85,6 +102,8 @@ FEDORA=($(sort -Vu <<<"${FEDORA[*]}"))
85102
UBUNTU=($(sort -Vu <<<"${UBUNTU[*]}"))
86103
unset IFS
87104

105+
cp supported_versions supported_versions.bak
106+
88107
echo -n "" > supported_versions
89108
echo "NGINX=(\"${NGINX[*]}\")" | sed 's/ /" "/g' >> supported_versions
90109
echo "ALPINE=(\"${ALPINE[*]}\")" | sed 's/ /" "/g' >> supported_versions
@@ -93,3 +112,7 @@ echo "CENTOS=(\"${CENTOS[*]}\")" | sed 's/ /" "/g' >> supported_versions
93112
echo "DEBIAN=(\"${DEBIAN[*]}\")" | sed 's/ /" "/g' >> supported_versions
94113
echo "FEDORA=(\"${FEDORA[*]}\")" | sed 's/ /" "/g' >> supported_versions
95114
echo "UBUNTU=(\"${UBUNTU[*]}\")" | sed 's/ /" "/g' >> supported_versions
115+
116+
DIFF=$(diff supported_versions supported_versions.bak; echo $?)
117+
rm supported_versions.bak
118+
exit $DIFF

0 commit comments

Comments
 (0)