Skip to content

Commit c559c25

Browse files
kouraulcd
andauthored
Prepare release scripts (#137)
## What's Changed This is based on the release scripts used by apache/arrow-java: https://github.com/apache/arrow-java/tree/main/dev/release Here is the release workflow: 1. Bump version in `package.json` 2. Run `dev/release/release_rc.sh 1` 1. This push `vX.Y.Z-rc1` tag 2. The tag push runs GitHub Actions workflow for RC that: 1. Generates source archive and packages for https://www.npmjs.com/ 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 3. Start a vote on `[email protected]` 4. Run `dev/release/release.sh 1` after the vote carried 1. This push `vX.Y.Z`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/ 5. This publishes the voted packages to https://www.npmjs.com/ 5. Add the release to ASF's report database: https://reporter.apache.org/addrelease.html?arrow See also the added `dev/release/README.md`. Closes #9. --------- Co-authored-by: Raúl Cumplido <[email protected]>
1 parent 061b8c5 commit c559c25

File tree

9 files changed

+997
-16
lines changed

9 files changed

+997
-16
lines changed

.github/workflows/rc.yaml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
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+
run: |
50+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
51+
version=${GITHUB_REF_NAME%-rc*}
52+
version=${version#v}
53+
rc=${GITHUB_REF_NAME#*-rc}
54+
else
55+
version=$(jq -r .version package.json)
56+
rc=$(date +%Y%m%d)
57+
fi
58+
echo "version=${version}" >> ${GITHUB_OUTPUT}
59+
echo "rc=${rc}" >> ${GITHUB_OUTPUT}
60+
61+
source:
62+
name: Source
63+
needs: target
64+
runs-on: ubuntu-latest
65+
timeout-minutes: 5
66+
env:
67+
RC: ${{ needs.target.outputs.rc }}
68+
VERSION: ${{ needs.target.outputs.version }}
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
72+
- name: Archive
73+
run: |
74+
id="apache-arrow-js-${VERSION}"
75+
tar_gz="${id}.tar.gz"
76+
echo "TAR_GZ=${tar_gz}" >> ${GITHUB_ENV}
77+
git archive HEAD --prefix "${id}/" --output "${tar_gz}"
78+
sha256sum "${tar_gz}" > "${tar_gz}.sha256"
79+
sha512sum "${tar_gz}" > "${tar_gz}.sha512"
80+
- name: Upload
81+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
82+
with:
83+
name: release-source
84+
path: |
85+
apache-arrow-js-*.tar.gz*
86+
- name: Audit
87+
run: |
88+
dev/release/run_rat.sh "${TAR_GZ}"
89+
90+
packages:
91+
name: Packages
92+
runs-on: ubuntu-latest
93+
timeout-minutes: 10
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
97+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
98+
with:
99+
cache: yarn
100+
node-version: 20
101+
- name: Install dependencies
102+
run: |
103+
yarn install
104+
- name: Build
105+
run: |
106+
yarn gulp build
107+
108+
shopt -s globstar
109+
for package_json in targets/**/package.json; do
110+
if [[ ${package_json} =~ bin/package.json$ ]]; then
111+
continue
112+
fi
113+
npm pack "${PWD}/$(dirname ${package_json})"
114+
done
115+
for tgz in *.tgz; do
116+
sha256sum "${tgz}" > "${tgz}.sha256"
117+
sha512sum "${tgz}" > "${tgz}.sha512"
118+
done
119+
- name: Upload
120+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
121+
with:
122+
name: release-packages
123+
path: |
124+
apache-arrow-*.tgz*
125+
126+
verify:
127+
name: Verify
128+
needs:
129+
- packages
130+
- source
131+
- target
132+
runs-on: ubuntu-latest
133+
timeout-minutes: 45
134+
env:
135+
RC: ${{ needs.target.outputs.rc }}
136+
VERSION: ${{ needs.target.outputs.version }}
137+
steps:
138+
- name: Checkout
139+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
140+
- name: Download
141+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
142+
with:
143+
pattern: release-*
144+
- name: Verify
145+
env:
146+
VERIFY_DEFAULT: 0
147+
VERIFY_PACKAGE: 1
148+
VERIFY_SOURCE: 1
149+
run: |
150+
mv release-*/* ./
151+
dev/release/verify_rc.sh "${VERSION}" "${RC}"
152+
153+
upload:
154+
name: Upload
155+
needs:
156+
- target
157+
- verify
158+
runs-on: ubuntu-latest
159+
timeout-minutes: 5
160+
permissions:
161+
contents: write
162+
env:
163+
RC: ${{ needs.target.outputs.rc }}
164+
VERSION: ${{ needs.target.outputs.version }}
165+
steps:
166+
- name: Download
167+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
168+
with:
169+
pattern: release-*
170+
- name: Upload
171+
if: github.ref_type == 'tag'
172+
env:
173+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174+
run: |
175+
gh release create ${GITHUB_REF_NAME} \
176+
--generate-notes \
177+
--prerelease \
178+
--repo ${GITHUB_REPOSITORY} \
179+
--title "Apache Arrow JS ${VERSION} RC${RC}" \
180+
--verify-tag \
181+
release-*/*.tar.gz* \
182+
release-*/*.tgz*

.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 JS ${version}" \
57+
--verify-tag \
58+
dists/*

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ test/__snapshots__/
9494
dev/release/apache-rat-*.jar
9595
dev/release/filtered_rat.txt
9696
dev/release/rat.xml
97+
98+
# Release
99+
dev/release/.env
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env bash
2-
31
# Licensed to the Apache Software Foundation (ASF) under one
42
# or more contributor license agreements. See the NOTICE file
53
# distributed with this work for additional information
@@ -16,15 +14,20 @@
1614
# KIND, either express or implied. See the License for the
1715
# specific language governing permissions and limitations
1816
# under the License.
19-
set -e
20-
21-
# validate the targets pass all tests before publishing
22-
yarn --frozen-lockfile
23-
yarn gulp
2417

25-
read -p "Please enter your npm 2FA one-time password (or leave empty if you don't have 2FA enabled): " NPM_OTP </dev/tty
18+
# The GitHub token to upload artifacts to GitHub Release.
19+
#
20+
# You must set this.
21+
#GH_TOKEN=secret
22+
export GH_TOKEN
2623

27-
# collect targets by finding package.json files
28-
# skips any in a bin dir, see GH-44585
29-
find targets -type f -name package.json ! -path "*/bin/*" -execdir sh -c \
30-
"npm publish \$(dirname \$(realpath {})) ${NPM_OTP:+ --otp=$NPM_OTP}" \;
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)