Skip to content

Commit 5adbb48

Browse files
authored
chore: Add release scripts (#42)
## What's Changed This is based on the release scripts in apache/arrow-js. Here is the release workflow: 1. Run `dev/release/release_rc.sh 21.0.0 0` 1. This push `v21.0.0-rc0` tag 2. The tag push runs GitHub Actions workflow for RC that: 1. Generates source archive 2. Verifies these artifacts 3. Creates a GitHub Release for the RC and uploads these artifacts to the GitHub Release 3. This downloads these artifacts from the GitHub Release 4. This signs these artifacts on local and upload these signs to the GitHub Release 5. This shows vote e-mail template 2. Start a vote on `[email protected]` 3. Run `dev/release/release.sh 21.0.0 0` after the vote carried 1. This push `v21.0.0`tag 2. The tag push runs GitHub Actions workflow for release that: 1. Creates a GitHub Release for the release and copies all artifacts from the GitHub Release for the RC 3. This uploads the voted source archive to https://dist.apache.org/repos/dist/release/arrow/ 4. This removes old releases from https://dist.apache.org/repos/dist/release/arrow/ 4. Add the release to ASF's report database: https://reporter.apache.org/addrelease.html?arrow See also the added `dev/release/README.md`. Closes #8.
1 parent e7e2ded commit 5adbb48

File tree

9 files changed

+924
-4
lines changed

9 files changed

+924
-4
lines changed

.github/workflows/rc.yaml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. 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,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: RC
19+
20+
on:
21+
push:
22+
branches:
23+
- "**"
24+
- "!dependabot/**"
25+
tags:
26+
- "*-rc*"
27+
pull_request:
28+
29+
concurrency:
30+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
31+
cancel-in-progress: true
32+
33+
permissions:
34+
contents: read
35+
36+
jobs:
37+
target:
38+
name: Target
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
outputs:
42+
version: ${{ steps.detect.outputs.version }}
43+
rc: ${{ steps.detect.outputs.rc }}
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
- name: Detect
48+
id: detect
49+
env:
50+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: |
52+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
53+
version=${GITHUB_REF_NAME%-rc*}
54+
version=${version#v}
55+
rc=${GITHUB_REF_NAME#*-rc}
56+
else
57+
last_release_tag=$(gh release list \
58+
--exclude-drafts \
59+
--exclude-pre-releases \
60+
--jq '.[].tagName' \
61+
--json tagName \
62+
--limit 1)
63+
if [ -n "${last_release_tag}" ]; then
64+
version=${last_release_tag#v}
65+
else
66+
version=1.0.0
67+
fi
68+
rc=$(date +%Y%m%d)
69+
fi
70+
echo "version=${version}" >> ${GITHUB_OUTPUT}
71+
echo "rc=${rc}" >> ${GITHUB_OUTPUT}
72+
73+
source:
74+
name: Source
75+
needs: target
76+
runs-on: ubuntu-latest
77+
timeout-minutes: 5
78+
env:
79+
RC: ${{ needs.target.outputs.rc }}
80+
VERSION: ${{ needs.target.outputs.version }}
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
84+
- name: Archive
85+
run: |
86+
id="apache-arrow-swift-${VERSION}"
87+
tar_gz="${id}.tar.gz"
88+
echo "TAR_GZ=${tar_gz}" >> ${GITHUB_ENV}
89+
git archive HEAD --prefix "${id}/" --output "${tar_gz}"
90+
sha256sum "${tar_gz}" > "${tar_gz}.sha256"
91+
sha512sum "${tar_gz}" > "${tar_gz}.sha512"
92+
- name: Upload
93+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
94+
with:
95+
name: release-source
96+
path: |
97+
apache-arrow-swift-*.tar.gz*
98+
- name: Audit
99+
run: |
100+
dev/release/run_rat.sh "${TAR_GZ}"
101+
102+
verify:
103+
name: Verify
104+
needs:
105+
- source
106+
- target
107+
runs-on: ubuntu-latest
108+
timeout-minutes: 45
109+
env:
110+
RC: ${{ needs.target.outputs.rc }}
111+
VERSION: ${{ needs.target.outputs.version }}
112+
steps:
113+
- name: Checkout
114+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115+
- name: Setup Swift
116+
uses: swift-actions/setup-swift@682457186b71c25a884c45c06f859febbe259240 # v2.3.0
117+
with:
118+
swift-version: "5.10"
119+
- name: Download
120+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
121+
with:
122+
pattern: release-*
123+
- name: Verify
124+
env:
125+
VERIFY_DEFAULT: 0
126+
VERIFY_SOURCE: 1
127+
run: |
128+
mv release-*/* ./
129+
dev/release/verify_rc.sh "${VERSION}" "${RC}"
130+
131+
upload:
132+
name: Upload
133+
needs:
134+
- target
135+
- verify
136+
runs-on: ubuntu-latest
137+
timeout-minutes: 5
138+
permissions:
139+
contents: write
140+
env:
141+
RC: ${{ needs.target.outputs.rc }}
142+
VERSION: ${{ needs.target.outputs.version }}
143+
steps:
144+
- name: Download
145+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
146+
with:
147+
pattern: release-*
148+
- name: Upload
149+
if: github.ref_type == 'tag'
150+
env:
151+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
run: |
153+
gh release create ${GITHUB_REF_NAME} \
154+
--generate-notes \
155+
--prerelease \
156+
--repo ${GITHUB_REPOSITORY} \
157+
--title "Apache Arrow Swift ${VERSION} RC${RC}" \
158+
--verify-tag \
159+
release-*/*.tar.gz*

.github/workflows/release.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. 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,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Release
19+
20+
on:
21+
push:
22+
tags:
23+
- "*"
24+
- "!*-rc*"
25+
26+
permissions:
27+
contents: write
28+
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
jobs:
33+
publish:
34+
name: Publish
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 5
37+
steps:
38+
- name: Download RC contents
39+
run: |
40+
set -x
41+
latest_rc_tag=$(gh release list \
42+
--jq '.[].tagName' \
43+
--json tagName \
44+
--repo ${GITHUB_REPOSITORY} | \
45+
grep -F "${GITHUB_REF_NAME}-rc" | \
46+
head -n1)
47+
gh release download ${latest_rc_tag} \
48+
--repo ${GITHUB_REPOSITORY} \
49+
--dir dists
50+
- name: Create GitHub Release
51+
run: |
52+
version=${GITHUB_REF_NAME#v}
53+
gh release create ${GITHUB_REF_NAME} \
54+
--generate-notes \
55+
--repo ${GITHUB_REPOSITORY} \
56+
--title "Apache Arrow Swift ${version}" \
57+
--verify-tag \
58+
dists/*

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ xcuserdata/
3131
/dev/release/apache-rat-*.jar
3232
/dev/release/filtered_rat.txt
3333
/dev/release/rat.xml
34+
35+
# Release
36+
/apache-arrow-swift-*.tar.gz*
37+
/dev/release/.env

ci/scripts/build.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@ rm -rf "${build_dir}"
3737
mkdir -p "${build_dir}"
3838
cp -a "${source_dir}" "${build_dir}/source"
3939
rm -rf "${build_dir}/source/.build"
40-
mkdir -p /cache/swift-build
41-
ln -s /cache/swift-build "${build_dir}/source/.build"
40+
if [ -d /cache ]; then
41+
mkdir -p /cache/swift-build
42+
ln -s /cache/swift-build "${build_dir}/source/.build"
43+
fi
4244
github_actions_group_end
4345

4446
github_actions_group_begin "Generate data"
4547
data_gen_dir="${build_dir}/source/data-generator/swift-datagen"
46-
export GOCACHE="/cache/go-build"
47-
export GOMODCACHE="/cache/go-mod"
48+
if [ -d /cache ]; then
49+
export GOCACHE="/cache/go-build"
50+
export GOMODCACHE="/cache/go-mod"
51+
fi
4852
export GOPATH="${build_dir}"
4953
pushd "${data_gen_dir}"
5054
go get -d ./...

dev/release/.env.example

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. 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,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# The GitHub token to upload artifacts to GitHub Release.
19+
#
20+
# You must set this.
21+
#GH_TOKEN=secret
22+
export GH_TOKEN
23+
24+
# The GPG key ID to sign artifacts. The GPG key ID must be registered
25+
# to both of the followings:
26+
#
27+
# * https://dist.apache.org/repos/dist/dev/arrow/KEYS
28+
# * https://dist.apache.org/repos/dist/release/arrow/KEYS
29+
#
30+
# See these files how to import your GPG key ID to these files.
31+
#
32+
# You must set this.
33+
#GPG_KEY_ID=08D3564B7C6A9CAFBFF6A66791D18FCF079F8007

0 commit comments

Comments
 (0)