Skip to content

Commit dc581f0

Browse files
authored
GH-45316: [Release][C#] Use GitHub Releases for artifacts (#45317)
### Rationale for this change We don't need to use Artifactory for NuGet packages because it's not published to Artifactory. ### What changes are included in this PR? * Use GitHub Releases for easy to maintain * Use `.github/workflows/csharp.yml` instead of nightly job for easy to maintain ### Are these changes tested? Almost yes. ### Are there any user-facing changes? No. * GitHub Issue: #45316
1 parent 12f6265 commit dc581f0

14 files changed

+203
-136
lines changed

.github/workflows/csharp.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,88 @@ jobs:
133133
- name: Test
134134
shell: bash
135135
run: ci/scripts/csharp_test.sh $(pwd)
136+
137+
package:
138+
name: Package
139+
# Branch or RC tag
140+
if: github.ref_type != 'tag' || contains(github.ref_name, 'rc')
141+
runs-on: ubuntu-latest
142+
timeout-minutes: 15
143+
permissions:
144+
contents: write
145+
steps:
146+
- name: Checkout for utilities
147+
if: github.ref_type == 'tag'
148+
uses: actions/checkout@v4
149+
with:
150+
path: arrow
151+
- name: Download source archive
152+
if: github.ref_type == 'tag'
153+
run: |
154+
arrow/dev/release/utils-watch-gh-workflow.sh \
155+
${GITHUB_REF_NAME} \
156+
release_candidate.yml
157+
gh release download ${GITHUB_REF_NAME} \
158+
--pattern "*.tar.gz" \
159+
--repo ${GITHUB_REPOSITORY}
160+
tar -xf *.tar.gz --strip-components=1
161+
mv csharp/dummy.git .git
162+
env:
163+
GH_TOKEN: ${{ github.token }}
164+
- name: Checkout
165+
if: github.ref_type != 'tag'
166+
uses: actions/checkout@v4
167+
with:
168+
fetch-depth: 0
169+
- name: Prepare version
170+
if: github.ref_type != 'tag'
171+
run: |
172+
# apache-arrow-20.0.0.dev-9-g758867f907 ->
173+
# 20.0.0.dev-9-g758867f907 ->
174+
# 20.0.0.dev-9 ->
175+
# 20.0.0-dev-9
176+
semver="$(git describe --tags | \
177+
sed -E \
178+
-e 's/^apache-arrow-//' \
179+
-e 's/-[^-]*$//' \
180+
-e 's/^([0-9]*\.[0-9]*\.[0-9])\./\1-/')"
181+
sed -i'' -E -e \
182+
"s/^ <Version>.+<\/Version>/ <Version>${semver}<\/Version>/" \
183+
csharp/Directory.Build.props
184+
- name: Setup Python
185+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
186+
with:
187+
python-version: 3
188+
- name: Setup Archery
189+
run: |
190+
python3 -m pip install -e 'dev/archery[docker]'
191+
- name: Build
192+
run: |
193+
archery docker run ubuntu-csharp
194+
- name: Prepare artifacts
195+
run: |
196+
shopt -s globstar
197+
cp csharp/artifacts/**/*.{,s}nupkg ./
198+
for artifact in *.{,s}nupkg; do
199+
dev/release/utils-generate-checksum.sh "${artifact}"
200+
done
201+
- name: Upload
202+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
203+
with:
204+
name: nuget
205+
path: |
206+
*.nupkg
207+
*.sha256
208+
*.sha512
209+
*.snupkg
210+
- name: Publish
211+
if: github.ref_type == 'tag'
212+
run: |
213+
gh release upload ${GITHUB_REF_NAME} \
214+
--repo ${GITHUB_REPOSITORY} \
215+
*.nupkg \
216+
*.sha256 \
217+
*.sha512 \
218+
*.snupkg
219+
env:
220+
GH_TOKEN: ${{ github.token }}

.github/workflows/release.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ env:
3232

3333
jobs:
3434
publish:
35-
name: Publish
35+
name: Publish
3636
runs-on: ubuntu-latest
3737
timeout-minutes: 5
3838
steps:
3939
- name: Get Tag Name of Latest Release Candidate
4040
run: |
41-
rc_tag=$(gh release list --repo apache/arrow | \
41+
rc_tag=$(gh release list --repo ${GITHUB_REPOSITORY} | \
4242
cut -f3 | \
4343
grep -F "${GITHUB_REF_NAME}-rc" | \
4444
head -n1)
@@ -52,23 +52,25 @@ jobs:
5252
echo "VERSION_WITH_RC=${version_with_rc}" >> ${GITHUB_ENV}
5353
echo "VERSION=${version}" >> ${GITHUB_ENV}
5454
echo "RC_NUM=${rc_num}" >> ${GITHUB_ENV}
55-
- name: Download Release Candidate Artifacts
55+
- name: Download Release Candidate Artifacts
5656
run: |
5757
mkdir release_candidate_artifacts
58-
gh release download ${RELEASE_CANDIDATE_TAG_NAME} --repo apache/arrow --dir release_candidate_artifacts
58+
gh release download ${RELEASE_CANDIDATE_TAG_NAME} \
59+
--dir release_candidate_artifacts \
60+
--repo ${GITHUB_REPOSITORY}
5961
- name: Create Release Title
6062
run: |
6163
title="Apache Arrow ${VERSION}"
6264
echo "RELEASE_TITLE=${title}" >> ${GITHUB_ENV}
6365
# Set the release notes to "TODO" temporarily. After the release notes page
64-
# (https://arrow.apache.org/release/{VERSION}.html) is published, use
65-
# gh release edit to update the release notes to refer to the newly
66+
# (https://arrow.apache.org/release/{VERSION}.html) is published, use
67+
# gh release edit to update the release notes to refer to the newly
6668
# pushed web page. See dev/post/post-05-update-gh-release-notes.sh
6769
- name: Create GitHub Release
6870
run: |
6971
gh release create ${GITHUB_REF_NAME} \
70-
--repo apache/arrow \
71-
--verify-tag \
72-
--title "${RELEASE_TITLE}" \
7372
--notes "TODO" \
74-
release_candidate_artifacts/*
73+
--repo ${GITHUB_REPOSITORY} \
74+
--title "${RELEASE_TITLE}" \
75+
--verify-tag \
76+
release_candidate_artifacts/*

.github/workflows/release_candidate.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ env:
3232

3333
jobs:
3434
publish:
35-
name: Publish
35+
name: Publish
3636
runs-on: ubuntu-latest
3737
timeout-minutes: 5
38-
steps:
38+
steps:
3939
- name: Checkout Arrow
4040
uses: actions/checkout@v4
4141
with:
@@ -58,13 +58,14 @@ jobs:
5858
echo "RELEASE_CANDIDATE_NOTES=${release_notes}" >> ${GITHUB_ENV}
5959
- name: Create Release tarball
6060
run: |
61-
cd dev/release/ && ./utils-create-release-tarball.sh ${VERSION} ${RC_NUM}
61+
dev/release/utils-create-release-tarball.sh ${VERSION} ${RC_NUM}
6262
echo "RELEASE_TARBALL=apache-arrow-${VERSION}.tar.gz" >> ${GITHUB_ENV}
63+
dev/release/utils-generate-checksum.sh "apache-arrow-${VERSION}.tar.gz"
6364
- name: Create GitHub Release
6465
run: |
6566
gh release create ${GITHUB_REF_NAME} \
6667
--verify-tag \
6768
--prerelease \
6869
--title "${RELEASE_CANDIDATE_TITLE}" \
6970
--notes "Release Notes: ${RELEASE_CANDIDATE_NOTES}" \
70-
dev/release/${RELEASE_TARBALL}
71+
${RELEASE_TARBALL}*

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,5 @@ repos:
183183
?^ci/scripts/c_glib_build\.sh$|
184184
?^ci/scripts/c_glib_test\.sh$|
185185
?^c_glib/test/run-test\.sh$|
186+
?^dev/release/utils-generate-checksum\.sh$|
186187
)

dev/release/02-source-test.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ def test_vote
143143
#{@current_commit} [2]
144144
145145
The source release rc0 is hosted at [3].
146-
The binary artifacts are hosted at [4][5][6][7][8][9][10].
147-
The changelog is located at [11].
146+
The binary artifacts are hosted at [4][5][6][7][8][9].
147+
The changelog is located at [10].
148148
149149
Please download, verify checksums and signatures, run the unit tests,
150-
and vote on the release. See [12] for how to validate a release candidate.
150+
and vote on the release. See [11] for how to validate a release candidate.
151151
152-
See also a verification result on GitHub pull request [13].
152+
See also a verification result on GitHub pull request [12].
153153
154154
The vote will be open for at least 72 hours.
155155
@@ -164,12 +164,11 @@ def test_vote
164164
[5]: https://apache.jfrog.io/artifactory/arrow/amazon-linux-rc/
165165
[6]: https://apache.jfrog.io/artifactory/arrow/centos-rc/
166166
[7]: https://apache.jfrog.io/artifactory/arrow/debian-rc/
167-
[8]: https://apache.jfrog.io/artifactory/arrow/nuget-rc/#{@release_version}-rc0
168-
[9]: https://apache.jfrog.io/artifactory/arrow/python-rc/#{@release_version}-rc0
169-
[10]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
170-
[11]: https://github.com/apache/arrow/blob/#{@current_commit}/CHANGELOG.md
171-
[12]: https://arrow.apache.org/docs/developers/release_verification.html
172-
[13]: #{verify_pr_url || "null"}
167+
[8]: https://apache.jfrog.io/artifactory/arrow/python-rc/#{@release_version}-rc0
168+
[9]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
169+
[10]: https://github.com/apache/arrow/blob/#{@current_commit}/CHANGELOG.md
170+
[11]: https://arrow.apache.org/docs/developers/release_verification.html
171+
[12]: #{verify_pr_url || "null"}
173172
VOTE
174173
end
175174
end

dev/release/02-source.sh

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ rc_url="https://dist.apache.org/repos/dist/dev/arrow/${tag}"
4646
echo "Preparing source for tag ${tag}"
4747

4848
: ${release_hash:=$(cd "${SOURCE_TOP_DIR}" && git rev-list --max-count=1 ${tag})}
49+
: ${GITHUB_REPOSITORY:=apache/arrow}
4950

5051
if [ ${SOURCE_UPLOAD} -gt 0 ]; then
5152
if [ -z "$release_hash" ]; then
@@ -62,35 +63,40 @@ if [ ${SOURCE_DOWNLOAD} -gt 0 ]; then
6263
# Wait for the release candidate workflow to finish before attempting
6364
# to download the tarball from the GitHub Release.
6465
. $SOURCE_DIR/utils-watch-gh-workflow.sh ${tag} "release_candidate.yml"
65-
rm -f ${tarball}
66-
gh release download \
67-
${tag} \
68-
--repo apache/arrow \
69-
--dir . \
70-
--pattern "${tarball}"
66+
. $SOURCE_DIR/utils-watch-gh-workflow.sh ${tag} "csharp.yml"
67+
rm -rf artifacts
68+
gh release download ${tag} \
69+
--dir artifacts \
70+
--repo "${GITHUB_REPOSITORY}"
7171
fi
7272

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

77-
if type shasum >/dev/null 2>&1; then
78-
sha256_generate="shasum -a 256"
79-
sha512_generate="shasum -a 512"
80-
else
81-
sha256_generate="sha256sum"
82-
sha512_generate="sha512sum"
83-
fi
84-
85-
8677
if [ ${SOURCE_UPLOAD} -gt 0 ]; then
87-
# sign the archive
88-
gpg --armor --output ${tarball}.asc --detach-sig ${tarball}
89-
${sha256_generate} $tarball > ${tarball}.sha256
90-
${sha512_generate} $tarball > ${tarball}.sha512
78+
rm -rf signed-artifacts
79+
mkdir -p signed-artifacts
80+
81+
# sign the artifacts
82+
for artifact in artifacts/*; do
83+
case "${artifact}" in
84+
*.sha256|*.sha512)
85+
continue
86+
;;
87+
esac
88+
gpg \
89+
--armor \
90+
--detach-sig \
91+
--output signed-artifacts/$(basename ${artifact}).asc \
92+
${artifact}
93+
done
9194

9295
# Upload signed tarballs to GitHub Release
93-
gh release upload --repo apache/arrow ${tag} ${tarball}.sha256 ${tarball}.sha512
96+
gh release upload ${tag} \
97+
--repo "${GITHUB_REPOSITORY}" \
98+
--verify-tag \
99+
signed-artifacts/*
94100

95101
# check out the arrow RC folder
96102
svn co --depth=empty https://dist.apache.org/repos/dist/dev/arrow tmp
@@ -99,13 +105,16 @@ if [ ${SOURCE_UPLOAD} -gt 0 ]; then
99105
mkdir -p tmp/${tag}
100106

101107
# copy the rc tarball into the tmp dir
102-
cp ${tarball}* tmp/${tag}
108+
cp artifacts/${tarball}* tmp/${tag}
109+
cp signed-artifacts/${tarball}.asc tmp/${tag}
103110

104111
# commit to svn
105112
svn add tmp/${tag}
106113
svn ci -m "Apache Arrow ${version} RC${rc}" tmp/${tag}
107114

108115
# clean up
116+
rm -rf artifacts
117+
rm -rf signed-artifacts
109118
rm -rf tmp
110119

111120
echo "Success! The release candidate is available here:"
@@ -124,7 +133,7 @@ if [ ${SOURCE_PR} -gt 0 ]; then
124133
--head-branch=${rc_branch} \
125134
--pr-body="PR to verify Release Candidate" \
126135
--pr-title="WIP: [Release] Verify ${rc_branch}" \
127-
--remote=https://github.com/apache/arrow \
136+
--remote=https://github.com/${GITHUB_REPOSITORY} \
128137
--rc=${rc} \
129138
--verify-source \
130139
--version=${version}
@@ -143,7 +152,7 @@ if [ ${SOURCE_VOTE} -gt 0 ]; then
143152
curl_options+=(--get)
144153
curl_options+=(--data "state=open")
145154
curl_options+=(--data "head=apache:${rc_branch}")
146-
curl_options+=(https://api.github.com/repos/apache/arrow/pulls)
155+
curl_options+=(https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls)
147156
verify_pr_url=$(curl "${curl_options[@]}" | jq -r ".[0].html_url")
148157
echo "The following draft email has been created to send to the"
149158
echo "[email protected] mailing list"
@@ -163,13 +172,13 @@ This release candidate is based on commit:
163172
${release_hash} [2]
164173
165174
The source release rc${rc} is hosted at [3].
166-
The binary artifacts are hosted at [4][5][6][7][8][9][10].
167-
The changelog is located at [11].
175+
The binary artifacts are hosted at [4][5][6][7][8][9].
176+
The changelog is located at [10].
168177
169178
Please download, verify checksums and signatures, run the unit tests,
170-
and vote on the release. See [12] for how to validate a release candidate.
179+
and vote on the release. See [11] for how to validate a release candidate.
171180
172-
See also a verification result on GitHub pull request [13].
181+
See also a verification result on GitHub pull request [12].
173182
174183
The vote will be open for at least 72 hours.
175184
@@ -184,12 +193,11 @@ The vote will be open for at least 72 hours.
184193
[5]: https://apache.jfrog.io/artifactory/arrow/amazon-linux-rc/
185194
[6]: https://apache.jfrog.io/artifactory/arrow/centos-rc/
186195
[7]: https://apache.jfrog.io/artifactory/arrow/debian-rc/
187-
[8]: https://apache.jfrog.io/artifactory/arrow/nuget-rc/${version}-rc${rc}
188-
[9]: https://apache.jfrog.io/artifactory/arrow/python-rc/${version}-rc${rc}
189-
[10]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
190-
[11]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md
191-
[12]: https://arrow.apache.org/docs/developers/release_verification.html
192-
[13]: ${verify_pr_url}
196+
[8]: https://apache.jfrog.io/artifactory/arrow/python-rc/${version}-rc${rc}
197+
[9]: https://apache.jfrog.io/artifactory/arrow/ubuntu-rc/
198+
[10]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md
199+
[11]: https://arrow.apache.org/docs/developers/release_verification.html
200+
[12]: ${verify_pr_url}
193201
MAIL
194202
echo "---------------------------------------------------------"
195203
fi

dev/release/05-binary-upload.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ fi
7272
: ${UPLOAD_CENTOS:=${UPLOAD_DEFAULT}}
7373
: ${UPLOAD_DEBIAN:=${UPLOAD_DEFAULT}}
7474
: ${UPLOAD_DOCS:=${UPLOAD_DEFAULT}}
75-
: ${UPLOAD_NUGET:=${UPLOAD_DEFAULT}}
7675
: ${UPLOAD_PYTHON:=${UPLOAD_DEFAULT}}
7776
: ${UPLOAD_R:=${UPLOAD_DEFAULT}}
7877
: ${UPLOAD_UBUNTU:=${UPLOAD_DEFAULT}}
@@ -99,9 +98,6 @@ fi
9998
if [ ${UPLOAD_DOCS} -gt 0 ]; then
10099
rake_tasks+=(docs:rc)
101100
fi
102-
if [ ${UPLOAD_NUGET} -gt 0 ]; then
103-
rake_tasks+=(nuget:rc)
104-
fi
105101
if [ ${UPLOAD_PYTHON} -gt 0 ]; then
106102
rake_tasks+=(python:rc)
107103
fi

0 commit comments

Comments
 (0)