-
Notifications
You must be signed in to change notification settings - Fork 7
27 lines (26 loc) · 1.58 KB
/
update-readme.yaml
File metadata and controls
27 lines (26 loc) · 1.58 KB
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
name: Update README
on:
push:
jobs:
get-container-versions:
runs-on: ubuntu-22.04
outputs:
current: ${{ steps.fetch-image-versions.outputs.current }}
old: ${{ steps.fetch-image-versions.outputs.old }}
steps:
- name: Fetch latest container images
id: fetch-image-versions
run: |
token=$(curl -sL https://ghcr.io/token?scope=repository:moritzheiber/ruby-jemalloc:pull | jq -Mcj .token)
versions=$(curl -sL --header "Authorization: Bearer ${token}" https://ghcr.io/v2/moritzheiber/ruby-jemalloc/tags/list)
versions_thirty=$(echo ${versions} | jq -Mcj '.tags | map(scan("3\\.0\\.\\d*")) | unique | sort')
versions_thirtyone=$(echo ${versions} | jq -Mcj '.tags | map(scan("3\\.1\\.\\d*")) | unique | sort')
versions_thirtytwo=$(echo ${versions} | jq -Mcj '.tags | map(scan("3\\.2\\.\\d*")) | unique | sort')
current_thirty=$(echo ${versions_thirty} | jq -Mcj '.[-1:]')
current_thirtyone=$(echo ${versions_thirtyone} | jq -Mcj '.[-1:]')
current_thirtytwo=$(echo ${versions_thirtytwo} | jq -Mcj '.[-1:]')
old_thirty=$(echo ${versions_thirty} | jq -Mcj '.[:-1]')
old_thirtyone=$(echo ${versions_thirtyone} | jq -Mcj '.[:-1]')
old_thirtytwo=$(echo ${versions_thirtytwo} | jq -Mcj '.[:-1]')
echo "current=$(echo [${current_thirty},${current_thirtyone},${current_thirtytwo}] | jq -Mcj '. | flatten | sort')" >> $GITHUB_OUTPUT
echo "old=$(echo [${old_thirty},${old_thirtyone},${old_thirtytwo}] | jq -Mcj '. | flatten | sort')" >> $GITHUB_OUTPUT