Skip to content

Commit fdd9fc8

Browse files
Trim inputs to the job
1 parent e86a9ac commit fdd9fc8

1 file changed

Lines changed: 36 additions & 22 deletions

File tree

.github/workflows/jarbuild.yml

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,35 @@ jobs:
4444
runs-on: ubuntu-latest
4545
timeout-minutes: 5
4646
steps:
47+
- name: Trim workflow inputs
48+
run: |
49+
echo "ARROW_BRANCH=$(echo '${{github.event.inputs.arrow_branch}}' | xargs)" >> $GITHUB_ENV
50+
echo "ARROW_REPO=$(echo '${{github.event.inputs.arrow_repo}}' | xargs)" >> $GITHUB_ENV
51+
echo "RELEASE_TAG_NAME=$(echo '${{github.event.inputs.release_tag_name}}' | xargs)" >> $GITHUB_ENV
4752
- name: Print workflow input parameters
4853
run: |
4954
echo "=========================================="
5055
echo "Workflow Input Parameters"
5156
echo "=========================================="
52-
echo "arrow_branch: ${{github.event.inputs.arrow_branch}}"
53-
echo "arrow_repo: ${{github.event.inputs.arrow_repo}}"
54-
echo "release_tag_name: ${{github.event.inputs.release_tag_name}}"
57+
echo "arrow_branch: ${{env.ARROW_BRANCH}}"
58+
echo "arrow_repo: ${{env.ARROW_REPO}}"
59+
echo "release_tag_name: ${{env.RELEASE_TAG_NAME}}"
5560
echo "arrow-java branch: ${{github.ref_name}}"
5661
echo ""
5762
echo "Direct Links:"
5863
echo "----------------------------------------"
59-
echo "Arrow C++ repo/branch: https://github.com/${{github.event.inputs.arrow_repo}}/tree/${{github.event.inputs.arrow_branch}}"
64+
echo "Arrow C++ repo/branch: https://github.com/${{env.ARROW_REPO}}/tree/${{env.ARROW_BRANCH}}"
6065
echo "Arrow Java repo/branch: https://github.com/${{github.repository}}/tree/${{github.ref_name}}"
61-
echo "Release tag: https://github.com/${{github.repository}}/releases/tag/${{github.event.inputs.release_tag_name}}"
66+
echo "Release tag: https://github.com/${{github.repository}}/releases/tag/${{env.RELEASE_TAG_NAME}}"
6267
echo "=========================================="
6368
- name: Checkout
6469
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6570
with:
6671
submodules: recursive
67-
- name: Set env
68-
run: echo "release_tag_name=$(echo $release_tag_name)" >> $GITHUB_ENV
6972
- name: Prepare for tag
7073
run: |
71-
echo "${{github.event.inputs.release_tag_name}}"
72-
ver=$(echo ${{github.event.inputs.release_tag_name}})
74+
echo "${{env.RELEASE_TAG_NAME}}"
75+
ver=$(echo ${{env.RELEASE_TAG_NAME}})
7376
version=${ver%-rc*}
7477
version=${version#v}
7578
rc=${ver#*-rc}
@@ -118,6 +121,10 @@ jobs:
118121
contents: read
119122
packages: write
120123
steps:
124+
- name: Trim workflow inputs
125+
run: |
126+
echo "ARROW_BRANCH=$(echo '${{github.event.inputs.arrow_branch}}' | xargs)" >> $GITHUB_ENV
127+
echo "ARROW_REPO=$(echo '${{github.event.inputs.arrow_repo}}' | xargs)" >> $GITHUB_ENV
121128
- name: Download source archive
122129
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
123130
with:
@@ -133,8 +140,8 @@ jobs:
133140
# if: github.event_name == 'schedule'
134141
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135142
with:
136-
repository: ${{github.event.inputs.arrow_repo}}
137-
ref: ${{github.event.inputs.arrow_branch}}
143+
repository: ${{env.ARROW_REPO}}
144+
ref: ${{env.ARROW_BRANCH}}
138145
path: arrow
139146
- name: Checkout apache/arrow-testing
140147
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -185,6 +192,10 @@ jobs:
185192
env:
186193
MACOSX_DEPLOYMENT_TARGET: "15.0"
187194
steps:
195+
- name: Trim workflow inputs
196+
run: |
197+
echo "ARROW_BRANCH=$(echo '${{github.event.inputs.arrow_branch}}' | xargs)" >> $GITHUB_ENV
198+
echo "ARROW_REPO=$(echo '${{github.event.inputs.arrow_repo}}' | xargs)" >> $GITHUB_ENV
188199
- name: Download source archive
189200
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
190201
with:
@@ -200,8 +211,8 @@ jobs:
200211
# if: github.event_name == 'schedule'
201212
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
202213
with:
203-
repository: ${{github.event.inputs.arrow_repo}}
204-
ref: ${{github.event.inputs.arrow_branch}}
214+
repository: ${{env.ARROW_REPO}}
215+
ref: ${{env.ARROW_BRANCH}}
205216
path: arrow
206217
- name: Checkout apache/arrow-testing
207218
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -499,6 +510,9 @@ jobs:
499510
permissions:
500511
contents: write
501512
steps:
513+
- name: Trim workflow inputs
514+
run: |
515+
echo "RELEASE_TAG_NAME=$(echo '${{github.event.inputs.release_tag_name}}' | xargs)" >> $GITHUB_ENV
502516
- name: Download release artifacts
503517
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
504518
with:
@@ -507,39 +521,39 @@ jobs:
507521
- name: Upload
508522
run: |
509523
# GH-499: How to create release notes?
510-
echo "${{github.event.inputs.release_tag_name}}"
511-
ver=$(echo ${{github.event.inputs.release_tag_name}})
524+
echo "${{env.RELEASE_TAG_NAME}}"
525+
ver=$(echo ${{env.RELEASE_TAG_NAME}})
512526
version=${ver%-rc*}
513527
version=${version#v}
514528
rc=${ver#*-rc}
515-
529+
516530
# Create release if it doesn't exist, or skip if it does
517-
gh release create ${{github.event.inputs.release_tag_name}} \
531+
gh release create ${{env.RELEASE_TAG_NAME}} \
518532
--generate-notes \
519533
--prerelease \
520534
--repo ${GITHUB_REPOSITORY} \
521535
--title "Apache Arrow Java ${version} RC${rc}" \
522536
--verify-tag || echo "Release already exists, will update artifacts..."
523-
537+
524538
# Delete all existing assets from the release
525539
echo "Deleting existing artifacts..."
526-
gh release view ${{github.event.inputs.release_tag_name}} \
540+
gh release view ${{env.RELEASE_TAG_NAME}} \
527541
--repo ${GITHUB_REPOSITORY} \
528542
--json assets \
529543
--jq '.assets[].name' | while read asset; do
530544
echo "Deleting asset: $asset"
531-
gh release delete-asset ${{github.event.inputs.release_tag_name}} \
545+
gh release delete-asset ${{env.RELEASE_TAG_NAME}} \
532546
"$asset" \
533547
--repo ${GITHUB_REPOSITORY} \
534548
--yes || true
535549
done
536-
550+
537551
# GitHub CLI does not respect their own rate limits
538552
# https://github.com/cli/cli/issues/9586
539553
echo "Uploading new artifacts..."
540554
for artifact in artifacts/*/*; do
541555
sleep 1
542-
gh release upload ${{github.event.inputs.release_tag_name}} \
556+
gh release upload ${{env.RELEASE_TAG_NAME}} \
543557
--repo ${GITHUB_REPOSITORY} \
544558
$artifact
545559
done

0 commit comments

Comments
 (0)