Skip to content

Commit

Permalink
apacheGH-45316: [Release][C#] Use GitHub Releases for artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 21, 2025
1 parent 2d76789 commit 6dbf1bf
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 117 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,88 @@ jobs:
- name: Test
shell: bash
run: ci/scripts/csharp_test.sh $(pwd)

package:
name: Package
# Branch or RC tag
if: github.ref_type != 'tag' || contains(github.ref_name, 'rc')
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Checkout for utilities
if: github.ref_type == 'tag'
uses: actions/checkout@v4
with:
path: arrow
- name: Download source archive
if: github.ref_type == 'tag'
run: |
arrow/dev/release/utils-watch-gh-workflow.sh \
${GITHUB_REF_NAME} \
release_candidate.yml
gh release download ${GITHUB_REF_NAME} \
--pattern "*.tar.gz" \
--repo ${GITHUB_REPOSITORY}
tar -xf *.tar.gz --strip-components=1
mv csharp/dummy.git .git
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout
if: github.ref_type != 'tag'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare version
if: github.ref_type != 'tag'
run: |
# apache-arrow-20.0.0.dev-9-g758867f907 ->
# 20.0.0.dev-9-g758867f907 ->
# 20.0.0.dev-9 ->
# 20.0.0-dev-9
semver="$(git describe --tags | \
sed -E \
-e 's/^apache-arrow-//' \
-e 's/-[^-]*$//' \
-e 's/^([0-9]*\.[0-9]*\.[0-9])\./\1-/')"
sed -i'' -E -e \
"s/^ <Version>.+<\/Version>/ <Version>${semver}<\/Version>/" \
csharp/Directory.Build.props
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3
- name: Setup Archery
run: |
python3 -m pip install -e 'dev/archery[docker]'
- name: Build
run: |
archery docker run ubuntu-csharp
- name: Prepare artifacts
run: |
shopt -s globstar
cp csharp/artifacts/**/*.{,s}nupkg ./
for artifact in *.{,s}nupkg; do
dev/release/utils-generate-checksum.sh "${artifact}"
done
- name: Upload
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: nuget
path: |
*.nupkg
*.sha256
*.sha512
*.snupkg
- name: Publish
if: github.ref_type == 'tag'
run: |
gh release upload ${GITHUB_REF_NAME} \
--repo ${GITHUB_REPOSITORY} \
*.nupkg \
*.sha256 \
*.sha512 \
*.snupkg
env:
GH_TOKEN: ${{ github.token }}
9 changes: 5 additions & 4 deletions .github/workflows/release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ env:

jobs:
publish:
name: Publish
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
steps:
- name: Checkout Arrow
uses: actions/checkout@v4
with:
Expand All @@ -58,13 +58,14 @@ jobs:
echo "RELEASE_CANDIDATE_NOTES=${release_notes}" >> ${GITHUB_ENV}
- name: Create Release tarball
run: |
cd dev/release/ && ./utils-create-release-tarball.sh ${VERSION} ${RC_NUM}
dev/release/utils-create-release-tarball.sh ${VERSION} ${RC_NUM}
echo "RELEASE_TARBALL=apache-arrow-${VERSION}.tar.gz" >> ${GITHUB_ENV}
dev/release/utils-generate-checksum.sh "apache-arrow-${VERSION}.tar.gz"
- name: Create GitHub Release
run: |
gh release create ${GITHUB_REF_NAME} \
--verify-tag \
--prerelease \
--title "${RELEASE_CANDIDATE_TITLE}" \
--notes "Release Notes: ${RELEASE_CANDIDATE_NOTES}" \
dev/release/${RELEASE_TARBALL}
${RELEASE_TARBALL}*
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,5 @@ repos:
?^ci/scripts/c_glib_build\.sh$|
?^ci/scripts/c_glib_test\.sh$|
?^c_glib/test/run-test\.sh$|
?^dev/release/utils-generate-checksum\.sh$|
)
19 changes: 9 additions & 10 deletions dev/release/02-source-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ def test_vote
#{@current_commit} [2]
The source release rc0 is hosted at [3].
The binary artifacts are hosted at [4][5][6][7][8][9][10].
The changelog is located at [11].
The binary artifacts are hosted at [4][5][6][7][8][9].
The changelog is located at [10].
Please download, verify checksums and signatures, run the unit tests,
and vote on the release. See [12] for how to validate a release candidate.
and vote on the release. See [11] for how to validate a release candidate.
See also a verification result on GitHub pull request [13].
See also a verification result on GitHub pull request [12].
The vote will be open for at least 72 hours.
Expand All @@ -164,12 +164,11 @@ def test_vote
[5]: https://apache.jfrog.io/artifactory/arrow/amazon-linux-rc/
[6]: https://apache.jfrog.io/artifactory/arrow/centos-rc/
[7]: https://apache.jfrog.io/artifactory/arrow/debian-rc/
[8]: https://apache.jfrog.io/artifactory/arrow/nuget-rc/#{@release_version}-rc0
[9]: https://apache.jfrog.io/artifactory/arrow/python-rc/#{@release_version}-rc0
[10]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
[11]: https://github.com/apache/arrow/blob/#{@current_commit}/CHANGELOG.md
[12]: https://arrow.apache.org/docs/developers/release_verification.html
[13]: #{verify_pr_url || "null"}
[8]: https://apache.jfrog.io/artifactory/arrow/python-rc/#{@release_version}-rc0
[9]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
[10]: https://github.com/apache/arrow/blob/#{@current_commit}/CHANGELOG.md
[11]: https://arrow.apache.org/docs/developers/release_verification.html
[12]: #{verify_pr_url || "null"}
VOTE
end
end
66 changes: 34 additions & 32 deletions dev/release/02-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,35 +62,37 @@ if [ ${SOURCE_DOWNLOAD} -gt 0 ]; then
# Wait for the release candidate workflow to finish before attempting
# to download the tarball from the GitHub Release.
. $SOURCE_DIR/utils-watch-gh-workflow.sh ${tag} "release_candidate.yml"
rm -f ${tarball}
gh release download \
${tag} \
--repo apache/arrow \
--dir . \
--pattern "${tarball}"
. $SOURCE_DIR/utils-watch-gh-workflow.sh ${tag} "csharp.yml"
rm -f artifacts
gh release download ${tag} \
--dir artifacts \
--repo apache/arrow
fi

if [ ${SOURCE_RAT} -gt 0 ]; then
"${SOURCE_DIR}/run-rat.sh" ${tarball}
"${SOURCE_DIR}/run-rat.sh" artifacts/${tarball}
fi

if type shasum >/dev/null 2>&1; then
sha256_generate="shasum -a 256"
sha512_generate="shasum -a 512"
else
sha256_generate="sha256sum"
sha512_generate="sha512sum"
fi


if [ ${SOURCE_UPLOAD} -gt 0 ]; then
# sign the archive
gpg --armor --output ${tarball}.asc --detach-sig ${tarball}
${sha256_generate} $tarball > ${tarball}.sha256
${sha512_generate} $tarball > ${tarball}.sha512
rm -rf signed-artifacts
mkdir -p signed-artifacts

# sign the artifacts
for artifact in artifacts/*; do
case "${artifact}" in
*.sha256|*.sha512)
continue
;;
esac
gpg \
--armor \
--detach-sig \
--output signed-artifacts/$(basename ${artifact}).asc \
${artifact}
done

# Upload signed tarballs to GitHub Release
gh release upload --repo apache/arrow ${tag} ${tarball}.sha256 ${tarball}.sha512
gh release upload --repo apache/arrow ${tag} signed-artifacts/*

# check out the arrow RC folder
svn co --depth=empty https://dist.apache.org/repos/dist/dev/arrow tmp
Expand All @@ -99,7 +101,8 @@ if [ ${SOURCE_UPLOAD} -gt 0 ]; then
mkdir -p tmp/${tag}

# copy the rc tarball into the tmp dir
cp ${tarball}* tmp/${tag}
cp artifacts/${tarball}* tmp/${tag}
cp signed-artifacts/${tarball}.asc tmp/${tag}

# commit to svn
svn add tmp/${tag}
Expand Down Expand Up @@ -163,13 +166,13 @@ This release candidate is based on commit:
${release_hash} [2]
The source release rc${rc} is hosted at [3].
The binary artifacts are hosted at [4][5][6][7][8][9][10].
The changelog is located at [11].
The binary artifacts are hosted at [4][5][6][7][8][9].
The changelog is located at [10].
Please download, verify checksums and signatures, run the unit tests,
and vote on the release. See [12] for how to validate a release candidate.
and vote on the release. See [11] for how to validate a release candidate.
See also a verification result on GitHub pull request [13].
See also a verification result on GitHub pull request [12].
The vote will be open for at least 72 hours.
Expand All @@ -184,12 +187,11 @@ The vote will be open for at least 72 hours.
[5]: https://apache.jfrog.io/artifactory/arrow/amazon-linux-rc/
[6]: https://apache.jfrog.io/artifactory/arrow/centos-rc/
[7]: https://apache.jfrog.io/artifactory/arrow/debian-rc/
[8]: https://apache.jfrog.io/artifactory/arrow/nuget-rc/${version}-rc${rc}
[9]: https://apache.jfrog.io/artifactory/arrow/python-rc/${version}-rc${rc}
[10]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
[11]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md
[12]: https://arrow.apache.org/docs/developers/release_verification.html
[13]: ${verify_pr_url}
[8]: https://apache.jfrog.io/artifactory/arrow/python-rc/${version}-rc${rc}
[9]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
[10]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md
[11]: https://arrow.apache.org/docs/developers/release_verification.html
[12]: ${verify_pr_url}
MAIL
echo "---------------------------------------------------------"
fi
4 changes: 0 additions & 4 deletions dev/release/05-binary-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fi
: ${UPLOAD_CENTOS:=${UPLOAD_DEFAULT}}
: ${UPLOAD_DEBIAN:=${UPLOAD_DEFAULT}}
: ${UPLOAD_DOCS:=${UPLOAD_DEFAULT}}
: ${UPLOAD_NUGET:=${UPLOAD_DEFAULT}}
: ${UPLOAD_PYTHON:=${UPLOAD_DEFAULT}}
: ${UPLOAD_R:=${UPLOAD_DEFAULT}}
: ${UPLOAD_UBUNTU:=${UPLOAD_DEFAULT}}
Expand All @@ -99,9 +98,6 @@ fi
if [ ${UPLOAD_DOCS} -gt 0 ]; then
rake_tasks+=(docs:rc)
fi
if [ ${UPLOAD_NUGET} -gt 0 ]; then
rake_tasks+=(nuget:rc)
fi
if [ ${UPLOAD_PYTHON} -gt 0 ]; then
rake_tasks+=(python:rc)
fi
Expand Down
11 changes: 0 additions & 11 deletions dev/release/binary-task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,6 @@ def define
define_apt_tasks
define_yum_tasks
define_docs_tasks
define_nuget_tasks
define_python_tasks
define_r_tasks
define_summary_tasks
Expand Down Expand Up @@ -1899,14 +1898,6 @@ def define_docs_tasks
"test-debian-12-docs/**/*")
end

def define_nuget_tasks
define_generic_data_tasks("NuGet",
:nuget,
"#{rc_dir}/nuget/#{full_version}",
"#{release_dir}/nuget/#{full_version}",
"nuget/**/*")
end

def define_python_tasks
define_generic_data_tasks("Python",
:python,
Expand Down Expand Up @@ -1989,7 +1980,6 @@ def define_summary_tasks
https://apache.jfrog.io/artifactory/arrow/centos#{suffix}-rc/
https://apache.jfrog.io/artifactory/arrow/debian#{suffix}-rc/
https://apache.jfrog.io/artifactory/arrow/docs#{suffix}-rc/
https://apache.jfrog.io/artifactory/arrow/nuget#{suffix}-rc/#{full_version}
https://apache.jfrog.io/artifactory/arrow/python#{suffix}-rc/#{full_version}
https://apache.jfrog.io/artifactory/arrow/r#{suffix}-rc/#{full_version}
https://apache.jfrog.io/artifactory/arrow/ubuntu#{suffix}-rc/
Expand All @@ -2007,7 +1997,6 @@ def define_summary_tasks
https://apache.jfrog.io/artifactory/arrow/centos#{suffix}/
https://apache.jfrog.io/artifactory/arrow/debian#{suffix}/
https://apache.jfrog.io/artifactory/arrow/docs#{suffix}/
https://apache.jfrog.io/artifactory/arrow/nuget#{suffix}/#{version}
https://apache.jfrog.io/artifactory/arrow/python#{suffix}/#{version}
https://apache.jfrog.io/artifactory/arrow/r#{suffix}/#{version}
https://apache.jfrog.io/artifactory/arrow/ubuntu#{suffix}/
Expand Down
2 changes: 1 addition & 1 deletion dev/release/download_rc_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def is_target(path):
if package_type == 'jars':
downloader = Maven()
prefix = ''
elif package_type == 'github':
elif package_type == 'github' or package_type == 'nuget':
downloader = GitHub(repository, tag)
prefix = ''
filter = None
Expand Down
4 changes: 2 additions & 2 deletions dev/release/post-08-csharp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ base_names+=(Apache.Arrow.Flight.${version})
base_names+=(Apache.Arrow.Flight.AspNetCore.${version})
base_names+=(Apache.Arrow.Flight.Sql.${version})
base_names+=(Apache.Arrow.Compression.${version})
for base_name in ${base_names[@]}; do
for base_name in "${base_names[@]}"; do
for extension in nupkg snupkg; do
path=${base_name}.${extension}
rm -f ${path}
curl \
--fail \
--location \
--remote-name \
https://apache.jfrog.io/artifactory/arrow/nuget/${version}/${path}
"https://github.com/apache/arrow/releases/download/apache-arrow-${version}/${path}"
done
dotnet nuget push \
${base_name}.nupkg \
Expand Down
4 changes: 2 additions & 2 deletions dev/release/utils-create-release-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ dummy_git=${root_folder}/csharp/dummy.git
mkdir ${dummy_git}
pushd ${dummy_git}
echo ${release_hash} > HEAD
echo '[remote "origin"] url = https://github.com/apache/arrow.git' >> config
echo "[remote \"origin\"] url = https://github.com/${GITHUB_REPOSITORY:-apache/arrow}.git" >> config
mkdir objects refs
popd
popd

# Create new tarball from modified source directory
tar czf ${tarball} ${root_folder}
Expand Down
Loading

0 comments on commit 6dbf1bf

Please sign in to comment.