-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: landing page for gh-actions (#116)
Co-authored-by: Revathyvenugopal162 <[email protected]> Co-authored-by: Revathy Venugopal <[email protected]>
- Loading branch information
1 parent
d9fa764
commit 6149139
Showing
6 changed files
with
88 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ name: "Documentation deploy development version." | |
description: "Deploy development documentation to GitHub pages." | ||
|
||
inputs: | ||
doc-artifact-name: | ||
description: "Name of the HTML documentation artifact." | ||
required: false | ||
default: 'documentation-html' | ||
type: string | ||
cname: | ||
description: 'The canonical name of the documentation website.' | ||
required: true | ||
|
@@ -15,32 +20,74 @@ runs: | |
using: "composite" | ||
steps: | ||
|
||
- name: "Install system dependencies" | ||
shell: bash | ||
run: | | ||
sudo apt-get install curl | ||
- name: "Checkout project in the GitHub Pages branch" | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: 'gh-pages' | ||
|
||
- name: "Create a fresh development folder" | ||
shell: bash | ||
run: rm -rf dev/ && mkdir dev/ | ||
|
||
- name: "Download the HTML documentation artifact" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: documentation-html | ||
path: documentation-html | ||
name: ${{ inputs.doc-artifact-name }} | ||
path: dev | ||
|
||
- name: "Display structure of downloaded files" | ||
shell: bash | ||
run: | | ||
ls -R | ||
- name: "Include CNAME and nojekyll files expected by GitHub pages" | ||
shell: bash | ||
run: | | ||
touch documentation-html/CNAME documentation-html/.nojekyll | ||
echo ${{ inputs.cname }} > documentation-html/CNAME | ||
- name: "Deploy devevelopment documentation" | ||
uses: JamesIves/[email protected] | ||
with: | ||
token: ${{ inputs.token }} | ||
branch: gh-pages | ||
folder: documentation-html | ||
clean: true | ||
clean-exclude: release | ||
single-commit: true | ||
touch CNAME .nojekyll | ||
echo ${{ inputs.cname }} > CNAME | ||
- name: "Generate the redirection URL" | ||
shell: bash | ||
run: | | ||
# Verify if there is any stable release in release/versions.json | ||
grep -E "\"version\": \"[0-9]+.[0-9]+ \(stable\)\"" release/versions.json | ||
if [ $? -eq 0 ]; | ||
then | ||
# Generate the URL pointing to the latest stable version | ||
echo "Found stable release. Generating stable redirection URL..." | ||
line=$(grep -n -E "\"version\": \"[0-9]+.[0-9]+ \(stable\)\"" release/versions.json) | ||
version=$(echo $line | grep -o -h -E "[0-9]+.[0-9]+") | ||
echo "URL=https://${{ inputs.cname }}/release/$version" >> $GITHUB_ENV | ||
else | ||
# Generate the URL pointing to the development version if no stable releases | ||
echo "Stable release not found. Generating development redirection URL..." | ||
echo "URL=https://${{ inputs.cname }}/dev" >> $GITHUB_ENV | ||
fi | ||
- name: "Update the redirection link" | ||
shell: bash | ||
run: | | ||
curl https://raw.githubusercontent.com/pyansys/actions/release/2.0/scripts/redirect.html -o index.html | ||
# HACK: if the GitHub actions variable is dereferenced inside the `sed` command a syntax error is raised. | ||
# The URL Github actions environmental variable is loaded inside a shell one to avoid this conflict. | ||
url=${{ env.URL }} | ||
echo "Value for url: $url" | ||
sed -i "s|var-url|$url|g" index.html | ||
cat index.html | ||
- name: "Commit new changes (if required)" | ||
shell: bash | ||
run: | | ||
if [[ ! -z $(git status -s) ]]; | ||
then | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "DOC: add development documentation" | ||
git push | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ name: "Documentation deploy stable version." | |
description: "Deploy stable documentation to GitHub pages." | ||
|
||
inputs: | ||
doc-artifact-name: | ||
description: "Name of the HTML documentation artifact." | ||
required: false | ||
default: 'documentation-html' | ||
type: string | ||
cname: | ||
description: 'The canonical name of the documentation website.' | ||
required: true | ||
|
@@ -76,7 +81,7 @@ runs: | |
if: env.ACCEPTED_FORMAT == 'true' | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: documentation-html | ||
name: ${{ inputs.doc-artifact-name }} | ||
path: release/${{ env.VERSION }} | ||
|
||
- name: "Set up Python ${{ inputs.python-version }}" | ||
|
@@ -98,6 +103,7 @@ runs: | |
shell: bash | ||
run: | | ||
curl https://raw.githubusercontent.com/pyansys/actions/release/2.0/scripts/version_mapper.py -o version_mapper.py | ||
curl https://raw.githubusercontent.com/pyansys/actions/release/2.0/scripts/redirect.html -o index.html | ||
- name: "Update the version JSON file" | ||
if: env.ACCEPTED_FORMAT == 'true' | ||
|
@@ -109,7 +115,7 @@ runs: | |
--new_version ${{ env.VERSION }} \ | ||
--render_last ${{ inputs.render-last }} | ||
# Remove the script to avoid Git tracking it | ||
rm -rf version_mapper.py | ||
rm -rf version_mapper.py index.html | ||
- name: "Commit new changes (if required)" | ||
if: env.ACCEPTED_FORMAT == 'true' | ||
|
@@ -119,7 +125,7 @@ runs: | |
then | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add release/ | ||
git add . | ||
git commit -m "DOC: add documentation for ${{ github.ref_name }}" | ||
git push | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Redirecting to var-url</title> | ||
<meta http-equiv="refresh" content="0; URL=var-url"> | ||
<link rel="canonical" href="var-url"> |
This file contains 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
This file contains 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