Skip to content

chore: Add release scripts #42

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

Merged
merged 2 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
159 changes: 159 additions & 0 deletions .github/workflows/rc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# 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:
push:
branches:
- "**"
- "!dependabot/**"
tags:
- "*-rc*"
pull_request:

concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

permissions:
contents: read

jobs:
target:
name: Target
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.detect.outputs.version }}
rc: ${{ steps.detect.outputs.rc }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Detect
id: detect
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
version=${GITHUB_REF_NAME%-rc*}
version=${version#v}
rc=${GITHUB_REF_NAME#*-rc}
else
last_release_tag=$(gh release list \
--exclude-drafts \
--exclude-pre-releases \
--jq '.[].tagName' \
--json tagName \
--limit 1)
if [ -n "${last_release_tag}" ]; then
version=${last_release_tag#v}
else
version=1.0.0
fi
rc=$(date +%Y%m%d)
fi
echo "version=${version}" >> ${GITHUB_OUTPUT}
echo "rc=${rc}" >> ${GITHUB_OUTPUT}

source:
name: Source
needs: target
runs-on: ubuntu-latest
timeout-minutes: 5
env:
RC: ${{ needs.target.outputs.rc }}
VERSION: ${{ needs.target.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Archive
run: |
id="apache-arrow-swift-${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: Upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: release-source
path: |
apache-arrow-swift-*.tar.gz*
- name: Audit
run: |
dev/release/run_rat.sh "${TAR_GZ}"

verify:
name: Verify
needs:
- source
- target
runs-on: ubuntu-latest
timeout-minutes: 45
env:
RC: ${{ needs.target.outputs.rc }}
VERSION: ${{ needs.target.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Swift
uses: swift-actions/setup-swift@682457186b71c25a884c45c06f859febbe259240 # v2.3.0
with:
swift-version: "5.10"
- name: Download
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: release-*
- name: Verify
env:
VERIFY_DEFAULT: 0
VERIFY_SOURCE: 1
run: |
mv release-*/* ./
dev/release/verify_rc.sh "${VERSION}" "${RC}"

upload:
name: Upload
needs:
- target
- verify
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
env:
RC: ${{ needs.target.outputs.rc }}
VERSION: ${{ needs.target.outputs.version }}
steps:
- name: Download
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: release-*
- name: Upload
if: github.ref_type == 'tag'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${GITHUB_REF_NAME} \
--generate-notes \
--prerelease \
--repo ${GITHUB_REPOSITORY} \
--title "Apache Arrow Swift ${VERSION} RC${RC}" \
--verify-tag \
release-*/*.tar.gz*
58 changes: 58 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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*"

permissions:
contents: write

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Download RC contents
run: |
set -x
latest_rc_tag=$(gh release list \
--jq '.[].tagName' \
--json tagName \
--repo ${GITHUB_REPOSITORY} | \
grep -F "${GITHUB_REF_NAME}-rc" | \
head -n1)
gh release download ${latest_rc_tag} \
--repo ${GITHUB_REPOSITORY} \
--dir dists
- name: Create GitHub Release
run: |
version=${GITHUB_REF_NAME#v}
gh release create ${GITHUB_REF_NAME} \
--generate-notes \
--repo ${GITHUB_REPOSITORY} \
--title "Apache Arrow Swift ${version}" \
--verify-tag \
dists/*
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ xcuserdata/
/dev/release/apache-rat-*.jar
/dev/release/filtered_rat.txt
/dev/release/rat.xml

# Release
/apache-arrow-swift-*.tar.gz*
/dev/release/.env
12 changes: 8 additions & 4 deletions ci/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ rm -rf "${build_dir}"
mkdir -p "${build_dir}"
cp -a "${source_dir}" "${build_dir}/source"
rm -rf "${build_dir}/source/.build"
mkdir -p /cache/swift-build
ln -s /cache/swift-build "${build_dir}/source/.build"
if [ -d /cache ]; then
mkdir -p /cache/swift-build
ln -s /cache/swift-build "${build_dir}/source/.build"
fi
github_actions_group_end

github_actions_group_begin "Generate data"
data_gen_dir="${build_dir}/source/data-generator/swift-datagen"
export GOCACHE="/cache/go-build"
export GOMODCACHE="/cache/go-mod"
if [ -d /cache ]; then
export GOCACHE="/cache/go-build"
export GOMODCACHE="/cache/go-mod"
fi
export GOPATH="${build_dir}"
pushd "${data_gen_dir}"
go get -d ./...
Expand Down
33 changes: 33 additions & 0 deletions dev/release/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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.

# The GitHub token to upload artifacts to GitHub Release.
#
# You must set this.
#GH_TOKEN=secret
export GH_TOKEN

# The GPG key ID to sign artifacts. The GPG key ID must be registered
# to both of the followings:
#
# * https://dist.apache.org/repos/dist/dev/arrow/KEYS
# * https://dist.apache.org/repos/dist/release/arrow/KEYS
#
# See these files how to import your GPG key ID to these files.
#
# You must set this.
#GPG_KEY_ID=08D3564B7C6A9CAFBFF6A66791D18FCF079F8007
Loading