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 011edfa
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 28 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 %}

0 comments on commit 011edfa

Please sign in to comment.