Skip to content

HDDS-10203. Update Github actions to v4 since Node.js 16 actions are … #4

HDDS-10203. Update Github actions to v4 since Node.js 16 actions are …

HDDS-10203. Update Github actions to v4 since Node.js 16 actions are … #4

Workflow file for this run

# 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.
# Build Ozone website v2 and commit it to a staging branch.
# This will be picked up by configurations in .asf.yml to publish it to a staging domain.
name: "auto-publish-website-v2"
on:
push:
branches:
# TODO update this to master when the new website is ready to be published.
- HDDS-9225-website-v2
jobs:
build:
runs-on: ubuntu-latest
steps:
# Check out the website source in the current working directory.
- name: "Checkout source branch ${{ github.ref_name }}"
uses: actions/checkout@v4
with:
path: 'src'
- name: "Build website"
working-directory: 'src'
# Website source is mounted as volume, so the build output ends up in ./src/build outside of the container.
run: |
docker compose run site pnpm run build
- name: "Checkout publish branch"
uses: actions/checkout@v4
with:
path: 'publish'
# TODO update this to asf-site when the website is ready to be published.
ref: 'asf-site-v2'
- name: "Commit changes"
working-directory: 'publish'
run: |
# Delete previous build from the branch, but preserve files with necessary metadata.
mv README.md .asf.yaml .git /tmp
rm -rf $(ls -A)
mv /tmp/README.md /tmp/.asf.yaml /tmp/.git .
# Commit new build to the branch.
cp -R ../src/build/. .
git config --global user.name 'Github Actions'
git config --global user.email 'noreply@github.com'
git add .
git commit -a -m "[auto] Apply changes from $GITHUB_REF_NAME $GITHUB_SHA" || true
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}