-
Notifications
You must be signed in to change notification settings - Fork 1.9k
109 lines (95 loc) · 3.86 KB
/
publish-website-on-branch-update.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#
# 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.
#
#
# The action to publish website on a push event to a branch with released Ignite.
#
# Note that GitHub Actions uses the workflow from a branch triggered by a push event.
# So, any updates of this workflow should be cherry-picked to released branches.
#
name: Publish website documentation
on:
workflow_dispatch:
push:
branches:
# Since ignite-2.10
- ignite-2.[0-9][0-9]
- ignite-2.[0-9][0-9].[0-9]
paths:
- docs/**
concurrency:
group: publish-website-group
jobs:
publish-documentation:
name: Publish documentation
runs-on: ubuntu-latest
steps:
- name: Check out 'ignite' repository code
uses: actions/checkout@v3
- name: Check that the version was released
run: |
mvn org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce -Drules=requireReleaseDeps,requireReleaseVersion -pl modules/core
- name: Get the version from POM file
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "IGNITE_VERSION=$version" >> $GITHUB_ENV
- name: Check out 'ignite-website' repository code
uses: actions/checkout@v3
with:
repository: 'apache/ignite-website'
token: ${{ secrets.IGNITE_WEBSITE_BUILD }}
- name: Check that documentation was published for given version
run: |
if ! grep -Fxq "$IGNITE_VERSION" ./docs/available-versions.txt
then
echo "Documentation must be published for given version: $IGNITE_VERSION"
exit 1
fi
- name: Get latest version
run: |
latest_version=$(cat ./latest | grep "version" | cut -d'=' -f2)
echo "LATEST_VERSION=$latest_version" >> $GITHUB_ENV
- name: Install prerequisites
run: |
sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
sudo chown -R $(whoami) /var/lib/gems/*
gem install jekyll bundler
- name: Build
run: |
cd ./_docs
if [[ "$IGNITE_VERSION" == "$LATEST_VERSION" ]]
then
echo "Building $IGNITE_VERSION version (latest)."
./build.sh --version=$IGNITE_VERSION --github-branch=$GITHUB_REF_NAME --latest
else
echo "Building $IGNITE_VERSION version."
./build.sh --version=$IGNITE_VERSION --github-branch=$GITHUB_REF_NAME
fi
- name: Commit and push
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add --all
git commit -a -m "Update $IGNITE_VERSION documentation." -m "Commit: $GITHUB_SHA."
git push origin master
echo "The documentation updated successfully. Check that the version was published successfully on"
echo "the Ignite website: https://ignite.apache.org/docs/latest/"