Skip to content

Commit

Permalink
Hardcode zsh tags in ohmyzsh/zsh docker image build
Browse files Browse the repository at this point in the history
  • Loading branch information
mcornella committed Nov 4, 2022
1 parent cc13383 commit fd1811e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,43 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Build images
env:
zsh_tags: |
master
5.9
5.8.1
5.8
5.7.1
5.7
5.6.2
5.6.1
5.6
5.5.1
5.5
5.4.2
5.4.1
5.4
5.3.1
5.3
5.2
5.1.1
5.1
5.0.8
5.0.7
5.0.6
5.0.5
5.0.4
5.0.3
5.0.2
5.0.1
5.0.0
4.3.17
4.3.16
4.3.15
4.3.14
4.3.13
4.3.12
4.3.11
run: |
for image in */Dockerfile; do
image="$(basename $(dirname $image))"
Expand Down
7 changes: 3 additions & 4 deletions zsh/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ USERNAME="$1"
# Get image from directory name
IMAGE="$(basename "$(pwd)")"

# List of published zshusers/zsh Docker images
versions="$(wget -qO- https://registry.hub.docker.com/v1/repositories/zshusers/zsh/tags | sed 's/[^0-9.]*"name": "\([^"]*\)"[^0-9.]*/\n\1\n/g;s/^\n//')"
# $zsh_tags is an environment variable passed via secrets

# Build images
for version in $versions; do
for version in $zsh_tags; do
docker buildx build -t "$USERNAME/$IMAGE:$version" --build-arg ZSH_VERSION="$version" .
done

# Tag latest image
latest=$(tr ' ' '\n' <<< "$versions" | sed '/^$/d' | sort -V | tail -2 | head -1)
latest=$(tr ' ' '\n' <<< "$zsh_tags" | sed '/^$/d' | sort -V | tail -2 | head -1)
docker tag "$USERNAME/$IMAGE:$latest" "$USERNAME/$IMAGE:latest"

0 comments on commit fd1811e

Please sign in to comment.