-
Notifications
You must be signed in to change notification settings - Fork 33
62 lines (58 loc) · 2.46 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 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 }}