| # 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: 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: | |
| # GH-499: How to create release notes? |
| version=${GITHUB_REF_NAME#v} |
| gh release create ${GITHUB_REF_NAME} \ |
| --generate-notes \ |
| --repo ${GITHUB_REPOSITORY} \ |
| --title "Apache Arrow Java ${version}" \ |
| --verify-tag |
| |
| # GitHub CLI does not respect their own rate limits |
| # https://github.com/cli/cli/issues/9586 |
| for artifact in dists/*; do |
| sleep 1 |
| gh release upload ${GITHUB_REF_NAME} \ |
| --repo ${GITHUB_REPOSITORY} \ |
| $artifact |
| done |
| - name: Checkout for publishing docs |
| uses: actions/checkout@v6 |
| with: |
| path: site |
| - name: Publish docs |
| run: | |
| set -x |
| |
| tar -xf dists/html.tar.gz |
| version=${GITHUB_REF_NAME#v} |
| |
| if [ "${GITHUB_REPOSITORY}" = "apache/arrow-java" ]; then |
| BRANCH=asf-site |
| else |
| BRANCH=gh-pages |
| fi |
| |
| cd site |
| git fetch |
| git switch -c "${BRANCH}" "origin/${BRANCH}" |
| |
| rm -rf current ${version} |
| cp -a ../html current |
| cp -a ../html ${version} |
| git add current ${version} |
| |
| git config --global user.name 'github-actions[bot]' |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' |
| git commit -m "Publish documentation (${GITHUB_REF_NAME})" |
| git push origin "${BRANCH}" |