Skip to content

Commit 5de24f7

Browse files
committed
Added script to check latest version regularly.
1 parent 2fd33b0 commit 5de24f7

File tree

7 files changed

+79
-4
lines changed

7 files changed

+79
-4
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Check manual dependencies
2+
3+
on:
4+
schedule:
5+
- cron: "25 3 * * 2" # weekly: tuesdays at 3:25
6+
workflow_dispatch: # Allow manual run
7+
8+
jobs:
9+
check-dependencies:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Check versions of manually managed dependencies
15+
run: |
16+
./release/100-check-latest-versions.sh

RELEASE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ The release process works like this:
4141
After fixing the code and the tests, a release candidate's tag can be overwritten by setting the option `force`
4242
to `force-reuse-tag` when invoking the workflow. This should only be used when a release candidate is released again
4343
should be overwritten. If the archive was already released on github, then it should be deleted first - as goreleaser will not force to overwrite it ([issue](https://github.com/goreleaser/goreleaser/issues/557)).
44+
45+
46+
## Updating Dependencies
47+
48+
Most dependencies are automatically checked for updates via [Dependabot](.github/dependabot.yml).
49+
50+
The remaining dependencies cannot be managed via Dependabot, because they are manually retrieved
51+
during release via [0-get-latest-dependencies-versions.sh](./release/0-get-latest-dependencies-versions.sh). Hence, a weekly GitHub Action [check-manual-dependencies](.github/workflows/check-manual-dependencies.yml) checks whether the committed [versions.txt](release/versions.txt) matches the actual latest versions. If there is a new version, then the build fails and the maintainers are automatically notified. To incorporate the new version, simply follow the instructions in the failed build.

release/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
tmp
22
generated.Dockerfile
33
.cache
4+
new.versions.txt

release/0-get-latest-dependencies-versions.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ LATEST_VERSION=""
55

66
HEADERS_FILE="release/.cache/headers.txt"
77

8+
# track all versions, so that we can detect any changes.
9+
export ALL_VERSIONS=""
10+
11+
registerVersion() {
12+
NAME="$1"
13+
VERSION_VAR="$2"
14+
VERSION_VALUE="${!VERSION_VAR}"
15+
16+
ALL_VERSIONS="$ALL_VERSIONS"$'\n'"$NAME $VERSION_VALUE"
17+
18+
echo "Established $NAME version $VERSION_VALUE"
19+
}
20+
821
retrieveLatestVersion() {
922
TYPE="$1" # tag or release
1023
REPO="$2"
@@ -68,23 +81,23 @@ retrieveLatestVersion() {
6881
# retrieve version: Google Protobuf
6982
retrieveLatestVersion "release" "protocolbuffers/protobuf" "v[0-9]+[.][0-9]+"
7083
export PROTO_VERSION="${LATEST_VERSION#"v"}"
71-
echo "Established Protobuf version $PROTO_VERSION"
84+
registerVersion "Protobuf" "PROTO_VERSION"
7285

7386
# retrieve version: go
7487
retrieveLatestVersion "tag" "golang/go" "go1[.][0-9]+[.][0-9]+"
7588
GO_VERSION="${LATEST_VERSION#"go"}"
7689
GO_VERSION="$(echo "$GO_VERSION" | sed -E "s/\.[0-9]+$//")" # remove patch version
77-
echo "Established Go version: $GO_VERSION"
90+
registerVersion "go" "GO_VERSION"
7891

7992
# retrieve version: goreleaser
8093
retrieveLatestVersion "tag" "goreleaser/goreleaser" "v1[.][0-9]+[.][0-9]+"
8194
export GORELEASER_VERSION="$LATEST_VERSION"
82-
echo "Established Goreleaser version: $GORELEASER_VERSION"
95+
registerVersion "Goreleaser" "GORELEASER_VERSION"
8396

8497
# retrieve version: protocurl
8598
retrieveLatestVersion "tag" "qaware/protocurl" "v[0-9]+[.][0-9]+[.][0-9]+"
8699
export PROTOCURL_RELEASED_VVERSION="$LATEST_VERSION"
87-
echo "Established latest released protoCURL version: $PROTOCURL_RELEASED_VVERSION"
100+
registerVersion "Latest released protoCURL" "PROTOCURL_RELEASED_VVERSION"
88101

89102
# compute download urls
90103
ARCH="$(uname -m | sed "s/x86_64/amd64/" | sed "s/x86_32/386/")"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
SAVED="release/versions.txt"
5+
NEW="release/new.versions.txt"
6+
7+
echo "Checking $SAVED against latest versions..."
8+
9+
# Ths scripts checks the latest versions of the dependencies against what
10+
# is checked in at versions.log. Any difference indicates, that a new
11+
# version is available and that a new release may be created.
12+
OUT="$NEW" ./release/101-save-latest-versions.sh
13+
14+
if diff "$SAVED" "$NEW"; then
15+
echo "✅ No new dependency versions."
16+
else
17+
echo "❗❗ New dependency versions found ❗❗"
18+
# diff is automatically printed in the if statement
19+
echo "Please do the following:
20+
1. Run ./release/101-save-latest-versions.sh
21+
2. Commit new versions
22+
3. Create a new release"
23+
exit 1
24+
fi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
source release/0-get-latest-dependencies-versions.sh
5+
6+
OUT="${OUT:-"release/versions.txt"}"
7+
8+
echo "$ALL_VERSIONS" | sed '/^$/d' >"$OUT"
9+
echo "Saved latest versions into $OUT."

release/versions.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Protobuf 21.5
2+
go 1.18
3+
Goreleaser v1.11.2
4+
Latest released protoCURL v1.5.3

0 commit comments

Comments
 (0)