-
Notifications
You must be signed in to change notification settings - Fork 21
79 lines (71 loc) · 2.91 KB
/
Copy pathdeploy-site.yml
File metadata and controls
79 lines (71 loc) · 2.91 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 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.
# Builds the MkDocs site and publishes the rendered output to the `asf-site`
# branch. ASF infrastructure serves that branch at the project website, as
# configured by `.asf.yaml` (`publish: whoami: asf-site`).
name: Deploy site
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: deploy-site
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
# Never publish from forks — only the canonical ASF repository.
if: github.repository_owner == 'apache'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# fetch_spec.py pulls the spec from GitHub at build time; a shallow
# checkout of the source branch is all we need.
fetch-depth: 1
- name: Build Docker image
run: docker build -t ossie-website .
- name: Build site
run: |
docker run --rm -v "${{ github.workspace }}:/docs" ossie-website build
# The mkdocs-material container runs as root, so the rendered output
# in site/ ends up owned by root. Reclaim it for the runner user so
# the publish step can write into it (e.g. touch .nojekyll).
sudo chown -R "$(id -u):$(id -g)" site
- name: Publish to asf-site
working-directory: site
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
# Disable Jekyll processing on the published output.
touch .nojekyll
# ASF infrastructure reads .asf.yaml from the published branch to
# learn it should serve this content (publish.whoami: asf-site), so
# carry it over from the source checkout into the output.
cp "${GITHUB_WORKSPACE}/.asf.yaml" .asf.yaml
git init -q
git checkout -q -b asf-site
git config user.name "Apache Ossie CI"
git config user.email "dev@ossie.apache.org"
git add -A
git commit -q -m "Publish site from ${GITHUB_SHA}"
git push -f \
"https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
asf-site:asf-site