Skip to content

Commit

Permalink
[ci] Publish in /preview/
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Aug 31, 2024
1 parent f8c2d6a commit 48c8ee6
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 53 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,41 @@ jobs:
run: PRODUCTION=1 ./run-qa-checks

- name: Setup Google Cloud
if: ${{ github.event_name=='push' }}
# if: ${{ github.event_name=='push' }}
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }}
project_id: ${{ secrets.GCS_PROJECT_ID }}
export_environment_variables: true

- name: 'Set up Cloud SDK'
if: ${{ github.event_name=='push' }}
# if: ${{ github.event_name=='push' }}
uses: 'google-github-actions/setup-gcloud@v2'

- name: Deploy pages to openwisp.io/docs
if: ${{ github.event_name=='push' }}
# if: ${{ github.event_name=='push' }}
run: |
gsutil -m rsync -r ${{ env.SRC_URL }} ${{ env.DST_URL }}
env:
SRC_URL: /home/runner/work/openwisp-docs/openwisp-docs/_build/docs/
DST_URL: gs://${{ secrets.GCS_DOCS_BUCKET_NAME }}/docs/
DST_URL: gs://${{ secrets.GCS_DOCS_BUCKET_NAME }}/docs/preview/

invalidate-cache:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.result == 'success' }} && ${{ github.event_name=='push' }}
if: ${{ needs.build.result == 'success' }}

steps:
- name: Authenticate to Google Cloud
# if: ${{ github.event_name=='push' }}
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }}
project_id: ${{ secrets.GCS_PROJECT_ID }}
export_environment_variables: true

- name: Invalid CDN cache on GCP
# if: ${{ github.event_name=='push' }}
uses: stefanodotit/github-actions-invalidate-gcp-cdn@v1
with:
load_balancer_name: ${{ secrets.GCS_MAIN_LOAD_BALANCER_NAME }}
Expand Down
46 changes: 23 additions & 23 deletions _templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
{%- if show_copyright and copyright|length -%}
{%- if hasdoc('copyright') -%}
{%- trans path=pathto('copyright'), copyright=copyright|e -%}
© <a href="{{ path }}">Copyright</a>{{ copyright }}
© <a href="{{ path }}">Copyright</a>{{ copyright }}
{%- endtrans -%}
{%- else -%}
{%- trans copyright=copyright|e -%}
© {{ copyright }}&nbsp;
{%- endtrans -%}
{%- endif -%}
{%- endif -%}
{%- if last_updated -%}
{%- trans last_updated=last_updated|e -%}
Last updated: {{ last_updated }}.&nbsp;
{%- endtrans -%}
{%- else -%}
{%- trans copyright=copyright|e -%}
© {{ copyright }}&nbsp;
{%- endtrans -%}
{%- endif -%}
{%- endif -%}
{%- if last_updated -%}
{%- trans last_updated=last_updated|e -%}
Last updated: {{ last_updated }}.&nbsp;
{%- endtrans -%}
{%- endif -%}
{%- if show_sphinx -%}
{%- trans sphinx_version=sphinx_version|e -%}
Built with <a class="font-medium underline underline-offset-4"
href="https://www.sphinx-doc.org"
rel="noreferrer">Sphinx {{ sphinx_version }}</a>
{%- endtrans -%}
{%- endif -%}
</p>
</div>
</div>
{%- block footer_after %}{%- endblock footer_after %}
{%- endif -%}
{%- if show_sphinx -%}
{%- trans sphinx_version=sphinx_version|e -%}
Built with <a class="font-medium underline underline-offset-4"
href="https://www.sphinx-doc.org"
rel="noreferrer">Sphinx {{ sphinx_version }}</a>
{%- endtrans -%}
{%- endif -%}
</p>
</div>
</div>
{%- block footer_after %}{%- endblock footer_after %}
</footer>
36 changes: 36 additions & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% extends "!layout.html" %}

{% block linktags %}
{{ super() }}
<link rel="canonical" href="{{ html_baseurl }}{{ docs_root }}/{{ current_ow_version }}/{{ pagename }}.html" />
{% endblock %}

{% block footer %}
{{ super() }}
<!-- Google Analytics v4 Cookieless -->
<script>
if (window.location.hostname === 'openwisp.io') {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
// NO COOKIES
gtag("consent", "default", {
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied",
analytics_storage: "denied",
});
}
</script>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-RGGYQ3GC31"
></script>
<script>
if (window.location.hostname === 'openwisp.io') {
gtag("js", new Date());
gtag("config", "G-RGGYQ3GC31");
}
</script>
{% endblock %}
29 changes: 4 additions & 25 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@
# 'logo_light': 'assets/design/openwisp-logo-black.svg',
# 'logo_dark': 'assets/design/openwisp-logo-black.svg',
'main_nav_links': {
'About': 'http://localhost:8080/',
'FAQ': 'http://localhost:8080/support/',
'Support': 'http://localhost:8080/support/',
'Blog': 'http://localhost:8080/blog/',
'About': 'https://openwisp.org/preview/',
'FAQ': 'https://openwisp.org/preview/faq/',
'Support': 'https://openwisp.org/preview/support/',
'Blog': 'https://openwisp.org/preview/blog/',
},
'show_prev_next': True,
# 'show_scrolltop': True,
Expand All @@ -172,27 +172,6 @@
# html_domain_indices = False # Don't need module indices
# html_copy_source = False # Don't need sources


# pydata
# html_theme_options = {
# "show_nav_level": 0,
# "navigation_depth": 3,
# "show_toc_level": 2,
# "collapse_navigation": True,
# "header_links_before_dropdown": 3,
# "show_version_warning_banner": False,
# "announcement": "",
# "logo": {
# "text": "OpenWISP",
# "image_dark": "assets/design/openwisp-logo-white.svg",
# },
# "secondary_sidebar_items": {
# "**/*": ["page-toc"],
# # "examples/no-sidebar": [],
# },
# # "navbar_center": ["version-switcher", "navbar-nav"],
# }

# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {
Expand Down

0 comments on commit 48c8ee6

Please sign in to comment.