Skip to content

Commit c0ed81e

Browse files
authored
Automate release process (#29)
fix #8 fix #27 * Add some scripts to release * dev/release/prepare.sh: For a new release. * dev/release/tag.sh: For tagging. * See https://datafusion-contrib.github.io/datafusion-c/main/developer/release.html how to release a new version. * Add support for GitHub Releases * Create a release page automatically when we tag a new version * Add support for publishing .deb/.rpm to https://apache.jfrog.io/artifactory/arrow/ * See also: https://lists.apache.org/thread/f47nmpmmydmr9613jty21sgbv83pr9tq
1 parent eeb2644 commit c0ed81e

21 files changed

Lines changed: 611 additions & 51 deletions

File tree

.github/workflows/doc.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ jobs:
4545
libgirepository1.0-dev \
4646
ninja-build \
4747
valac
48-
pip install \
49-
Jinja2 \
50-
Pygments \
51-
Sphinx \
52-
breathe \
53-
gi-docgen \
54-
meson \
55-
pydata_sphinx_theme
48+
pip install -r requirements.txt
5649
case ${GITHUB_REF} in
5750
refs/tags/*)
5851
version=${GITHUB_REF#refs/tags/}
@@ -96,17 +89,15 @@ jobs:
9689
path: html/
9790
- uses: actions/checkout@v3
9891
if: |
99-
github.event_name == 'push' &&
100-
(startsWith(github.ref, 'refs/tags/') ||
101-
github.ref == 'refs/heads/main')
92+
startsWith(github.ref, 'refs/tags/') ||
93+
github.ref == 'refs/heads/main'
10294
with:
10395
ref: gh-pages
10496
path: gh-pages
10597
- name: Deploy
10698
if: |
107-
github.event_name == 'push' &&
108-
(startsWith(github.ref, 'refs/tags/') ||
109-
github.ref == 'refs/heads/main')
99+
startsWith(github.ref, 'refs/tags/') ||
100+
github.ref == 'refs/heads/main'
110101
run: |
111102
rm -rf gh-pages/${VERSION}
112103
cp -a build/doc/html/ gh-pages/${VERSION}

.github/workflows/package.yaml

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,47 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26+
source:
27+
name: Source
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Prepare
31+
run: |
32+
case ${GITHUB_REF} in
33+
refs/tags/*)
34+
version=${GITHUB_REF#refs/tags/}
35+
;;
36+
*)
37+
version=${GITHUB_SHA}
38+
;;
39+
esac
40+
echo "VERSION=${version}" >> ${GITHUB_ENV}
41+
- uses: actions/checkout@v3
42+
with:
43+
submodules: true
44+
path: datafusion-c-${{ env.VERSION }}
45+
- name: Archive
46+
run: |
47+
rm -rf datafusion-c-${VERSION}/.git
48+
tar cvzf datafusion-c-${VERSION}.tar.gz datafusion-c-${VERSION}
49+
zip -r datafusion-c-${VERSION}.zip datafusion-c-${VERSION}
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
name: tar.gz
53+
path: datafusion-c-${{ env.VERSION }}.tar.gz
54+
- uses: actions/upload-artifact@v3
55+
with:
56+
name: zip
57+
path: datafusion-c-${{ env.VERSION }}.zip
58+
- uses: softprops/action-gh-release@v1
59+
if: |
60+
startsWith(github.ref, 'refs/tags/')
61+
with:
62+
body_path: datafusion-c-${{ env.VERSION }}/doc/source/news/${{ env.VERSION }}.md
63+
files: |
64+
datafusion-c-${{ env.VERSION }}.tar.gz
65+
datafusion-c-${{ env.VERSION }}.zip
66+
2667
build:
2768
name: Build
2869
runs-on: ubuntu-22.04
@@ -84,31 +125,29 @@ jobs:
84125
# target: debian-bookworm-arm64
85126
# test-docker-image: arm64v8/debian:bookworm
86127
- label: Ubuntu Focal amd64
87-
id: debian-focal-amd64
128+
id: ubuntu-focal-amd64
88129
task-namespace: apt
89130
target: ubuntu-focal
90131
test-docker-image: ubuntu:focal
91132
# - label: Ubuntu Focal arm64
92-
# id: debian-focal-arm64
133+
# id: ubuntu-focal-arm64
93134
# task-namespace: apt
94135
# target: ubuntu-focal-arm64
95136
# test-docker-image: arm64v8/ubuntu:focal
96137
- label: Ubuntu Jammy amd64
97-
id: debian-jammy-amd64
138+
id: ubuntu-jammy-amd64
98139
task-namespace: apt
99140
target: ubuntu-jammy
100141
test-docker-image: ubuntu:jammy
101142
# - label: Ubuntu Jammy arm64
102-
# id: debian-jammy-arm64
143+
# id: ubuntu-jammy-arm64
103144
# task-namespace: apt
104145
# target: ubuntu-jammy-arm64
105146
# test-docker-image: arm64v8/ubuntu:jammy
106147
steps:
107148
- uses: actions/checkout@v3
108149
with:
109150
submodules: true
110-
- name: Checkout Arrow
111-
uses: actions/checkout@v3
112151
- name: Install dependencies
113152
run: |
114153
sudo apt update
@@ -118,8 +157,7 @@ jobs:
118157
ruby
119158
- name: Update version
120159
if: |
121-
!startsWith(github.ref, 'refs/tags/') &&
122-
!startsWith(github.ref, 'refs/heads/maintenance/')
160+
!startsWith(github.ref, 'refs/tags/')
123161
run: |
124162
cd package
125163
rake version:update RELEASE_DATE=$(date +%Y-%m-%d)
@@ -145,13 +183,16 @@ jobs:
145183
startsWith(github.ref, 'refs/tags/')
146184
run: |
147185
mkdir -p ${{ matrix.id }}
186+
shopt -s globstar
148187
cp -a package/${{ matrix.task-namespace }}/repositories/**/*.* ${{ matrix.id }}/
149188
tar czf ${{ matrix.id }}.tar.gz ${{ matrix.id }}
189+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
150190
- name: Upload to release
151191
uses: softprops/action-gh-release@v1
152192
if: |
153193
startsWith(github.ref, 'refs/tags/')
154194
with:
195+
body_path: doc/source/news/${{ env.VERSION }}.md
155196
files: |
156197
${{ matrix.id }}.tar.gz
157198
- name: Test
@@ -160,4 +201,5 @@ jobs:
160201
--rm \
161202
--volume ${PWD}:/host:ro \
162203
${{ matrix.test-docker-image }} \
163-
/host/package/${{ matrix.task-namespace }}/test.sh
204+
/host/package/${{ matrix.task-namespace }}/test.sh \
205+
local

.prettierignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2022 Sutou Kouhei <kou@clear-code.com>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
/vendor/

dev/release/prepare.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2022 Sutou Kouhei <kou@clear-code.com>
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eux
18+
19+
if [ $# -lt 1 ]; then
20+
echo "Usage: $0 version"
21+
echo " e.g.: $0 11.0.0"
22+
exit 1
23+
fi
24+
25+
version=$1
26+
major_version=$(echo ${version} | grep -o -E '^[0-9]+')
27+
28+
source_dir="$(dirname "$0")/../.."
29+
30+
git fetch origin --tags
31+
32+
branch="prepare-${version}"
33+
git branch -D ${branch} || :
34+
git checkout -b ${branch} origin/main
35+
36+
pushd "${source_dir}"
37+
sed -i'.bak' \
38+
-e "s/^version = \".*\"/version = \"${version}\"/" \
39+
Cargo.toml
40+
rm Cargo.toml.bak
41+
git add Cargo.toml
42+
43+
sed -i'.bak' \
44+
-e "s/^version = \'.*\'/version = \"${version}\"/" \
45+
meson.build
46+
rm meson.build.bak
47+
git add meson.build
48+
popd
49+
50+
pushd "${source_dir}/package/debian/"
51+
sed -i'.bak' -E \
52+
-e "s/libdatafusion[0-9]+/libdatafusion${major_version}/g" \
53+
-e "s/libdatafusion-glib[0-9]+/libdatafusion-glib${major_version}/g" \
54+
-e "s/gir1\.2-datafusion-[0-9]+/gir1.2-datafusion-${major_version}/g" \
55+
control
56+
rm control.bak
57+
git add control
58+
git mv gir1.2-datafusion-*.install \
59+
gir1.2-datafusion-${major_version}.0.install
60+
git mv libdatafusion-glib[[:alnum:]]*.install \
61+
libdatafusion-glib${major_version}.install
62+
git mv libdatafusion[[:alnum:]]*.install \
63+
libdatafusion${major_version}.install
64+
popd
65+
66+
pushd "${source_dir}/doc/"
67+
latest_news_md=$(ls source/news/*.md | sort -n -r | head -n1)
68+
sed \
69+
-e "s/^# .*\$/# ${version} - $(date +%Y-%m-%d)/" \
70+
${latest_news_md} > source/news/${version}.md
71+
git add source/news/${version}.md
72+
sed -i'.bak' \
73+
-e "N; /^\.\. toctree::/ a \ \ \ news/${version}" \
74+
source/news.rst
75+
rm source/news.rst.bak
76+
git add source/news.rst
77+
sed -i'.bak' \
78+
-e "\,^ 'source' / 'news\.rst', i \ \ 'source' / 'news' / '${version}.md'," \
79+
meson.build
80+
rm meson.build.bak
81+
git add meson.build
82+
popd
83+
84+
pushd "${source_dir}/package"
85+
rake version:update
86+
git add .
87+
popd

dev/release/tag.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2022 Sutou Kouhei <kou@clear-code.com>
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eux
18+
19+
source_dir="$(dirname "$0")/../.."
20+
21+
version=$(grep "^version" "${source_dir}/Cargo.toml" | \
22+
head -n1 | \
23+
grep -o "[0-9.]*")
24+
git tag -a -m "Release ${version}!!!" ${version}
25+
git push origin ${version}

dev/release/verify-packages.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2022 Sutou Kouhei <kou@clear-code.com>
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eux
18+
19+
if [ $# -lt 1 ]; then
20+
echo "Usage: $0 rc"
21+
echo " $0 staging-rc"
22+
echo " $0 release"
23+
echo " $0 staging-release"
24+
echo " e.g.: $0 rc # Verify RC packages"
25+
echo " e.g.: $0 staging-rc # Verify RC packages on staging"
26+
echo " e.g.: $0 release # Verify release packages"
27+
echo " e.g.: $0 staging-release # Verify release packages on staging"
28+
exit 1
29+
fi
30+
31+
verify_type="$1"
32+
33+
source_dir="$(dirname "$0")/../.."
34+
35+
pushd "${source_dir}"
36+
for dir in package/{apt,yum}/*; do
37+
if [ ! -d "${dir}" ]; then
38+
continue
39+
fi
40+
base_name=${dir##*/}
41+
distribution=
42+
code_name=
43+
case ${base_name} in
44+
*-aarch64|*-arm64)
45+
;;
46+
almalinux-*|debian-*|ubuntu-*)
47+
distribution=${base_name%-*}
48+
code_name=${base_name#*-}
49+
;;
50+
esac
51+
if [ "${distribution}" = "" -o "#{code_name}" = "" ]; then
52+
continue
53+
fi
54+
package_type=$(basename "$(dirname "${dir}")")
55+
docker run \
56+
--rm \
57+
--volume "$PWD:/host" \
58+
-it \
59+
${distribution}:${code_name} \
60+
/host/package/${package_type}/test.sh \
61+
"${verify_type}"
62+
done
63+
popd

doc/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ depend_files = files(
2323
'source' / 'index.rst',
2424
'source' / 'install.rst',
2525
'source' / 'introduction.rst',
26+
'source' / 'news' / '10.0.0.md',
27+
'source' / 'news.rst',
2628
'source' / 'raw-c-api.rst',
2729
)
2830
depend_files += [gi_docgen_toml]

doc/source/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626

2727
extensions = [
2828
'breathe',
29+
'myst_parser',
2930
]
31+
source_suffix = {
32+
'.rst': 'restructuredtext',
33+
'.md': 'markdown',
34+
}
3035

3136
breathe_default_project = 'datafusion-c'
3237
breathe_domain_by_extension = {'h' : 'c'}

doc/source/developer.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.. Copyright 2022 Sutou Kouhei <kou@clear-code.com>
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
14+
Developer
15+
=========
16+
17+
.. toctree::
18+
19+
developer/release

0 commit comments

Comments
 (0)