Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-20: Add release scripts #496

Merged
merged 28 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .github/workflows/rc.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose at some point we should refactor the JNI build so we can include binary artifacts here too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's a good idea!
Can I merge the existing test_jni.yml to here?
Or should we keep these workflows separated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to tackle this right away. GitHub lets you run actions as a substep, so maybe we can run test_jni.yml as a substep, then pull the artifacts back into the release pipeline.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you thinking about a composite action (e.g. we're using it in apache/arrow: https://github.com/apache/arrow/tree/main/.github/actions/sync-nightlies ) or reusable workflow?

Anyway, lets' defer this: GH-500

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking reusable workflow, but either way works for me - I just mean there's no need to merge/duplicate the pipelines. I'm OK with deferring it, yes.

Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# 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: RC
on:
lidavidm marked this conversation as resolved.
Show resolved Hide resolved
push:
branches:
- "**"
- "!dependabot/**"
tags:
- "*-rc*"
pull_request:
schedule:
- cron: "0 0 * * *"
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
jobs:
archive:
name: Archive
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
- name: Prepare for tag
if: github.ref_type == 'tag'
run: |
version=${GITHUB_REF_NAME%-rc*}
version=${version#v}
rc=${GITHUB_REF_NAME#*-rc}
echo "VERSION=${version}" >> ${GITHUB_ENV}
echo "RC=${rc}" >> ${GITHUB_ENV}
- name: Prepare for branch
if: github.ref_type == 'branch'
run: |
version=$(grep -o '^ <version>.*</version>' "pom.xml" |
sed \
-e 's,^ <version>,,' \
-e 's,</version>$,,')
rc=$(date +%Y%m%d)
echo "VERSION=${version}" >> ${GITHUB_ENV}
echo "RC=${rc}" >> ${GITHUB_ENV}
- name: Archive
run: |
id="apache-arrow-java-${VERSION}"
tar_gz="${id}.tar.gz"
echo "TAR_GZ=${tar_gz}" >> ${GITHUB_ENV}
git archive HEAD --prefix "${id}/" --output "${tar_gz}"
sha256sum "${tar_gz}" > "${tar_gz}.sha256"
sha512sum "${tar_gz}" > "${tar_gz}.sha512"
- name: Audit
run: |
dev/release/run_rat.sh "${TAR_GZ}"
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: archive
path: |
apache-arrow-java-*
verify:
name: Verify
needs:
- archive
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: archive
- name: Verify
run: |
tar_gz=$(echo apache-arrow-java-*.tar.gz)
version=${tar_gz#apache-arrow-java-}
version=${version%.tar.gz}
# rc isn't used with VERIFY_DOWNLOAD=0
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
rc="${GITHUB_REF_NAME#*-rc}"
else
rc=$(date +%Y%m%d)
fi
VERIFY_DEFAULT=0 \
VERIFY_SOURCE=1 \
dev/release/verify_rc.sh "${version}" "${rc}"
upload:
name: Upload
if: github.ref_type == 'tag'
needs:
- verify
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: archive
- name: Upload
run: |
# GH-499: How to create release notes?
version=${GITHUB_REF_NAME%-rc*}
version=${version#v}
rc=${GITHUB_REF_NAME#*-rc}
gh release create ${GITHUB_REF_NAME} \
--generate-notes \
--prerelease \
--title "Apache Arrow Java ${version} RC${rc}" \
--verify-tag \
apache-arrow-java-*.tar.gz \
apache-arrow-java-*.tar.gz.sha*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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: Release
on:
push:
tags:
- "*"
- "!*-rc*"
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download RC contents
run: |
set -x
latest_rc_tag=$(gh release list --json tagName --jq '.[].tagName' | \
grep -F "${GITHUB_REF_NAME}-rc" | \
head -n1)
gh release download ${latest_rc_tag} --dir dists
- name: Create GitHub Release
run: |
# GH-499: How to create release notes?
version=${GITHUB_REF_NAME#v}
gh release create ${GITHUB_REF_NAME} \
--generate-notes \
--title "Apache Arrow Java ${version}" \
--verify-tag \
dists/*
147 changes: 147 additions & 0 deletions dev/release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<!---
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.
-->

# Release

## Overview

1. Test the revision to be released
2. Bump version (detailed later)
3. Prepare RC and vote (detailed later)
4. Publish (detailed later)
5. Bump version by `dev/release/bump_version.sh X.Y.Z-SNAPSHOT`

### Bump version

Run `dev/release/bump_version.sh` on a working copy of your fork not
`[email protected]:apache/arrow-java`:

```console
$ git clone [email protected]:${YOUR_GITHUB_ACCOUNT}/arrow-java.git arrow-java.${YOUR_GITHUB_ACCOUNT}
$ cd arrow-java.${YOUR_GITHUB_ACCOUNT}
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/bump_version.sh ${NEW_VERSION}
```

Here is an example to bump version to 19.0.0:

```
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/bump_version.sh 19.0.0
```

It creates a feature branch and adds a commit that bumps version. This
opens a pull request from the feature branch by `gh gr create`. So you
kou marked this conversation as resolved.
Show resolved Hide resolved
need `gh` command and GitHub personal access token.

See also:
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens

raulcd marked this conversation as resolved.
Show resolved Hide resolved
### Prepare RC and vote

Run `dev/release/release_rc.sh` on a working copy of
`[email protected]:apache/arrow-java` not your fork:
raulcd marked this conversation as resolved.
Show resolved Hide resolved

```console
$ git clone [email protected]:apache/arrow-java.git
$ cd arrow-java
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release_rc.sh ${RC}
(Send a vote email to [email protected].
You can use a draft shown by release_rc.sh for the email.)
```

Here is an example to release RC1:

```console
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release_rc.sh 1
```

The argument of `release_rc.sh` is the RC number. If RC1 has a
problem, we'll increment the RC number such as RC2, RC3 and so on.

Requirements to run `release_rc.sh`:

* You must be an Apache Arrow committer or PMC member
* You must prepare your PGP key for signing

If you don't have a PGP key,
https://infra.apache.org/release-signing.html#generate may be helpful.

Your PGP key must be registered to the followings:

* https://dist.apache.org/repos/dist/dev/arrow/KEYS
* https://dist.apache.org/repos/dist/release/arrow/KEYS

See the header comment of them how to add a PGP key.

Apache arrow committers can update them by Subversion client with
their ASF account. e.g.:

```console
$ svn co https://dist.apache.org/repos/dist/dev/arrow
raulcd marked this conversation as resolved.
Show resolved Hide resolved
$ cd arrow
$ editor KEYS
$ svn ci KEYS
```

### Publish

We need to do the followings to publish a new release:

* Publish to apache.org

Run `dev/release/release.sh` on a working copy of
`[email protected]:apache/arrow-java` not your fork to publish to
apache.org:

```console
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release.sh ${VERSION} ${RC}
```

Here is an example to release 19.0.0 RC1:

```console
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release.sh 19.0.0 1
```

Add the release to ASF's report database via [Apache Committee Report
Helper](https://reporter.apache.org/addrelease.html?arrow).

raulcd marked this conversation as resolved.
Show resolved Hide resolved
### Verify

We have a script to verify a RC.

You must install the following commands to use the script:

* `curl`
* `gpg`
* `shasum` or `sha256sum`/`sha512sum`
* `tar`

To verify a RC, run the following command line:

```console
$ dev/release/verify_rc.sh ${VERSION} ${RC}
```

Here is an example to verify the release 19.0.0 RC1:

```console
$ dev/release/verify_rc.sh 19.0.0 1
```

If the verification is successful, the message `RC looks good!` is shown.
Loading
Loading