-
Notifications
You must be signed in to change notification settings - Fork 38
203 lines (176 loc) · 5.63 KB
/
packaging.yaml
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: packaging
on:
push:
branches:
- main
tags:
- 'apache-arrow-nanoarrow-*-rc*'
pull_request:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare version
shell: bash
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
VERSION=${GITHUB_REF_NAME#apache-arrow-nanoarrow-}
VERSION=${VERSION%-rc*}
else
VERSION=$(grep 'set(NANOARROW_VERSION' CMakeLists.txt | \
grep -E -o '[0-9]+\.[0-9]+\.[0-9]+')
description=$(git describe \
--always \
--dirty \
--long \
--match "apache-arrow-nanoarrow-[0-9]*.*" \
--tags)
case "${description}" in
# apache-arrow-nanoarrow-0.1.0-10-1234567-dirty
apache-arrow-nanoarrow-*)
# 10-1234567-dirty
distance="${description#apache-arrow-nanoarrow-*.*.*-}"
# 10-1234567
distance="${distance%-dirty}"
# 10
distance="${distance%-*}"
;;
*)
distance=$(git log --format=oneline | wc -l)
;;
esac
VERSION="${VERSION}.dev${distance}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Create archive
shell: bash
run: |
dev/release/source_build.sh \
apache-arrow-nanoarrow-${VERSION} \
$(git log -n 1 --format=%h)
- uses: actions/upload-artifact@v4
with:
name: source
retention-days: 7
path: |
apache-arrow-nanoarrow-${{ env.VERSION }}.tar.gz
docs:
runs-on: ubuntu-latest
needs:
- source
steps:
- uses: actions/download-artifact@v4
with:
name: source
- name: Extract source archive
run: |
source_archive=$(echo apache-arrow-nanoarrow-*.tar.gz)
VERSION=${source_archive#apache-arrow-nanoarrow-}
VERSION=${VERSION%.tar.gz}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
tar xf apache-arrow-nanoarrow-${VERSION}.tar.gz
mv apache-arrow-nanoarrow-${VERSION} nanoarrow
- name: Build documentation
run: |
echo "::group::Docker Pull"
cd nanoarrow
docker compose run --rm -e GITHUB_ACTIONS docs
echo "::endgroup::"
- name: Compress docs
run: |
cp -R nanoarrow/docs/_build/html nanoarrow-docs
tar -czf docs.tgz nanoarrow-docs
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: docs
retention-days: 2
path: |
docs.tgz
update-asf-site:
runs-on: ubuntu-latest
needs:
- docs
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: docs
- name: Clone asf-site branch
uses: actions/checkout@v4
with:
ref: asf-site
path: pages-clone
- name: Update development documentation
env:
DOC_TAG: "main"
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
cd pages-clone
if [ -d "$DOC_TAG" ]; then
git rm -rf "$DOC_TAG"
fi
tar -xf ../docs.tgz
mv nanoarrow-docs "$DOC_TAG"
git add *
git commit --allow-empty -m"update documentation for tag $DOC_TAG"
- name: Push development documentation to asf-site
if: success() && github.repository == 'apache/arrow-nanoarrow' && github.ref == 'refs/heads/main'
run: |
cd pages-clone
git push
create-release:
runs-on: ubuntu-latest
needs:
- docs
- source
permissions:
contents: write
steps:
- name: Get all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: List release artifacts
run: |
find release-artifacts -type f
- name: Create release
if: success() && startsWith(github.ref, 'refs/tags/')
run: |
RELEASE_TAG=${GITHUB_REF#refs/*/}
UPLOAD=$(find release-artifacts -type f)
gh release create "${RELEASE_TAG}" \
--repo ${{ github.repository }} \
--prerelease \
--title "nanoarrow ${RELEASE_TAG}" \
${UPLOAD}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}