-
Notifications
You must be signed in to change notification settings - Fork 52
130 lines (119 loc) · 4.25 KB
/
release.yml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: release
on:
workflow_dispatch: {}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Free up disk space
run: |
sudo rm -rf \
/usr/share/dotnet \
/opt/ghc \
/usr/local/share/boost \
"$AGENT_TOOLSDIRECTORY" || true
docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
- name: Report disk space usage
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df -h .
sudo du -hx -d 4 --threshold=1G /usr/ | sort -hr | head
- uses: actions/checkout@v3
with:
fetch-depth: 0 # checkout tags so version in Manifest is set properly
- name: Configure Git user
run: |
git config user.email "releases@trinodb.io"
git config user.name "Trino release automation"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Log in to the Container registry
# locked to https://github.com/docker/login-action/releases/tag/v2.1.0
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set release version
run: |
# if there's a SNAPSHOT suffix, remove it and commit changes
DO_RELEASE=false
if grep -q '^[0-9]\+-SNAPSHOT$' version; then
sed -i 's/^\([0-9]\+\)-SNAPSHOT$/\1/' version
VERSION=$(cat version)
git diff
git commit -a -m "Release: $VERSION"
git tag -m "" "$VERSION"
# Verify tag was created and points to the release commit
git show tags/"$VERSION"
DO_RELEASE=true
fi
VERSION=$(cat version)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "DO_RELEASE=${DO_RELEASE}" >> $GITHUB_ENV
- name: Make release
run: |
if [ "$DO_RELEASE" != "true" ]; then
echo "Skipping the release step because not starting from a snapshot version"
exit 0
fi
skipped_images=(
testing/almalinux9-oj17-openldap-base
)
single_arch=(
testing/hdp3.1-hive
testing/hdp3.1-hive-kerberized
testing/hdp3.1-hive-kerberized-2
testing/hdp3.1-hive-kerberized-kms
)
multi_arch=(
testing/almalinux9-oj11
testing/almalinux9-oj17
testing/almalinux9-oj17-openldap
testing/almalinux9-oj17-openldap-referrals
testing/almalinux9-oj17-openldap-active-directory
testing/hive3.1-hive
testing/kerberos
testing/phoenix5
testing/spark3-delta
testing/spark3-iceberg
testing/spark3-hudi
testing/polaris-catalog
testing/unity-catalog
)
referenced_images=("${skipped_images[@]}" "${single_arch[@]}" "${multi_arch[@]}")
make meta
read -a images < <(make list)
export LC_ALL=C
mapfile -t ignored < <( \
comm -23 \
<(printf '%s\n' "${images[@]}" | sort) \
<(printf '%s\n' "${referenced_images[@]}" | sort) \
)
if [ "${#ignored[@]}" -ne 0 ]; then
echo "Images that would not get released: ${ignored[*]}"
echo "Must be explicitly added to either single_arch or multi_arch list or should be added to skipped list"
exit 2
fi
make prepare-release
make "${single_arch[@]/%/@$VERSION}"
# free up disk space
docker system prune --volumes
make "${multi_arch[@]/%/@$VERSION}" PLATFORMS="linux/amd64,linux/arm64"
single_remote=("${single_arch[@]/#/ghcr.io/trinodb/}")
./bin/push.sh "${single_remote[@]/%/:$VERSION}"
export PLATFORMS="linux/amd64,linux/arm64"
multi_remote=("${multi_arch[@]/#/ghcr.io/trinodb/}")
./bin/push.sh "${multi_remote[@]/%/:$VERSION}"
- name: Set next development version
run: |
((VERSION++))
echo "$VERSION-SNAPSHOT" > version
git diff
git commit -a -m "Prepare for next development iteration"
# Show the contents of the commit
git show HEAD
git push --tags origin master