Skip to content

Commit

Permalink
updates scripts and adds new tag wfs (#7)
Browse files Browse the repository at this point in the history
* updates scripts and adds new tag wfs

Signed-off-by: Roshan Khatri <[email protected]>
  • Loading branch information
roshkhatri authored Apr 9, 2024
1 parent cc4af32 commit 4720e99
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 48 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
test:
needs: generate-jobs
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: ${{ matrix.name }}
name: ${{ matrix.name }} - test
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -53,9 +53,18 @@ jobs:
- generate-jobs
- test
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: ${{ matrix.name }}
name: ${{ matrix.name }} - Build and push
runs-on: ${{ matrix.os }}
steps:
# Tags are created by generate.sh in the format `valkey-container:<tag>`
# This step modifies the tags to `username/valkey:<tag>` to be provided to build-push github action.
- name: Modify Tags
id: modify_tags
run: |
original_tags="${{ toJson(matrix.meta.entries[0].tags) }}"
tags=$(echo $original_tags | sed 's/valkey-container/${{ secrets.DOCKERHUB_USERNAME }}\/valkey/g'| sed 's/\[ *//; s/ *\]//; s/ //g')
echo "modified_tags=$tags" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand All @@ -74,8 +83,7 @@ jobs:
with:
file: ./${{ matrix.meta.entries[0].directory }}/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/valkey:${{ matrix.name }}
tags: ${{ steps.modify_tags.outputs.modified_tags }}
platforms: linux/amd64,linux/arm64
provenance: false
load: false
7 changes: 3 additions & 4 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ getArches() {
getArches 'valkey'

cat <<-EOH
# this file is generated via https://github.com/docker-library/redis/blob/$(fileCommit "$self")/$self
# this file is generated via https://github.com/valkey-io/valkey-container/blob/$(fileCommit "$self")/$self
Maintainers: Tianon Gravi <[email protected]> (@tianon),
Joseph Ferguson <[email protected]> (@yosifkit)
GitRepo: https://github.com/docker-library/redis.git
Maintainers: Roshan Khatri <[email protected]> (@roshkhatri)
GitRepo: https://github.com/valkey-io/valkey-container.git
EOH

# prints "$2$1$3$1...$N"
Expand Down
87 changes: 47 additions & 40 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,52 +93,59 @@ fi
versions=( "${versions[@]%/}" )

packages="$(
wget -qO- 'https://github.com/roshkhatri/valkey-hashes/raw/master/README' \
| jq -csR '
rtrimstr("\n")
| split("\n")
| map(
# this capture will naturally ignore comments and blank lines
capture(
[
"^hash[[:space:]]+",
"(?<file>valkey-",
"(?<version>([0-9.]+)(-rc[0-9]+)?|unstable",
"[.][^[:space:]]+)[[:space:]]+",
"(?<type>sha256|sha1)[[:space:]]+", # this filters us down to just the checksum types we are prepared to handle right now
"(?<sum>[0-9a-f]{64}|[0-9a-f]{40})[[:space:]]+",
"(?<url>[^[:space:]]+)",
"$"
] | join("")
)
| {
version: .version,
url: .url,
(.type): .sum,
}
wget -qO- 'https://github.com/valkey-io/valkey-hashes/raw/main/README' \
| jq -csR '
rtrimstr("\n")
| split("\n")
| map(
# this capture will naturally ignore comments and blank lines
capture(
[
"^hash[[:space:]]+",
"(?<file>valkey-",
"(?<version>([0-9.]+)(-rc[0-9]+)?|unstable)",
"[.][^[:space:]]+)[[:space:]]+",
"(?<type>sha256|sha1)[[:space:]]+", # this filters us down to just the checksum types we are prepared to handle right now
"(?<sum>[0-9a-f]{64}|[0-9a-f]{40})[[:space:]]+",
"(?<url>[^[:space:]]+)",
"$"
] | join("")
)
'
| {
version: .version,
url: .url,
(.type): .sum,
}
)
'
)"

for version in "${versions[@]}"; do
export version rcVersion="${version%-rc}"

doc="$(
jq <<<"$packages" -c '
map(
select(
.version
| (
startswith(env.rcVersion + ".")
or startswith(env.rcVersion + "-")
) and (
index("-")
| if env.version == env.rcVersion then not else . end
if [ "$version" = "unstable" ]; then
doc="$(
jq <<<"$packages" -c '
map(select(.version == "unstable"))[-1]
'
)"
else
doc="$(
jq <<<"$packages" -c '
map(
select(
.version
| (
startswith(env.rcVersion + ".")
or startswith(env.rcVersion + "-")
) and (
index("-")
| if env.version == env.rcVersion then not else . end
)
)
)
)[-1]
'
)"
)[-1]
'
)"
fi

fullVersion="$(jq <<<"$doc" -r '.version')"
echo "$version: $fullVersion"
Expand Down

0 comments on commit 4720e99

Please sign in to comment.