Bump actions/setup-node from 5 to 6 (#719) #2306
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Deploy | |
on: | |
push: | |
branches: | |
- "**" | |
- "!dependabot/**" | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v5 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Install Node.js | |
uses: actions/setup-node@v6 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "npm" | |
- name: Configure for production | |
if: | | |
github.repository == 'apache/arrow-site' | |
run: | | |
echo "JEKYLL_BASE_URL=" >> ${GITHUB_ENV} | |
echo "ORIGIN=${{ github.repository }}" >> ${GITHUB_ENV} | |
echo >> _extra_config.yml | |
- name: Configure for fork | |
if: | | |
github.repository != 'apache/arrow-site' | |
run: | | |
owner=$(jq --raw-output .repository.owner.login ${GITHUB_EVENT_PATH}) | |
repository=$(jq --raw-output .repository.name ${GITHUB_EVENT_PATH}) | |
echo "JEKYLL_BASE_URL=/${repository}" >> ${GITHUB_ENV} | |
echo "ORIGIN=${owner}/${repository}" >> ${GITHUB_ENV} | |
# "url:" is for the opengraph tags, and it can't be relative | |
echo "url: https://${owner}.github.io/${repository}" >> _extra_config.yml | |
- name: Build | |
run: | | |
export JEKYLL_DESTINATION=../build | |
export JEKYLL_ENV=production | |
export JEKYLL_EXTRA_CONFIG=_extra_config.yml | |
bundle exec rake generate | |
- name: Checkout asf-site | |
uses: actions/checkout@v5 | |
with: | |
path: asf-site | |
repository: apache/arrow-site | |
ref: asf-site | |
- name: Prepare archive | |
run: | | |
pushd asf-site | |
rsync \ | |
-a \ | |
--delete \ | |
--exclude '/docs/' \ | |
../../build/ \ | |
./ | |
popd | |
tar czf asf-site.tar.gz asf-site | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asf-site | |
path: | | |
asf-site.tar.gz | |
- name: Upload pages | |
if: | | |
github.repository != 'apache/arrow-site' | |
uses: actions/upload-pages-artifact@v4 | |
with: | |
path: asf-site/ | |
deploy-production: | |
name: Deploy on production | |
if: >- | |
github.event_name == 'push' && | |
github.repository == 'apache/arrow-site' && | |
github.ref_name == 'main' | |
needs: build | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout asf-site | |
uses: actions/checkout@v5 | |
with: | |
path: asf-site | |
ref: asf-site | |
- name: Download | |
uses: actions/download-artifact@v5 | |
with: | |
name: asf-site | |
- name: Push | |
run: | | |
mv asf-site/.git ./ | |
rm -rf asf-site | |
tar xf asf-site.tar.gz | |
mv .git asf-site/ | |
cd asf-site | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
# Ignore feed.xml changes because feed.xml always has a change. | |
# feed.xml uses the current time. So feed.xml is always different. | |
if [ "$(git status --porcelain | grep -v feed.xml)" != "" ]; then | |
# There are changes to the built site | |
git add --all | |
git commit -m "Updating built site" | |
git push | |
else | |
echo "No changes to the built site" | |
fi | |
deploy-fork: | |
name: Deploy on fork | |
if: >- | |
github.event_name == 'push' && | |
github.repository != 'apache/arrow-site' | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |