-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Add workflow to push to avd.arista.com on every devel commit #3849
Conversation
I think this gets us there. We do have to provide some type of PAT ---
# This is deploying the latest commits on devel to aristanetworks/avd-docs main branch
name: Deploy devel documentation to aristanetworks/avd-docs main
on:
push:
branches:
- devel
workflow_dispatch:
jobs:
'devel_doc':
name: 'Update Public devel documentation'
runs-on: ubuntu-latest
if: github.repository == 'aristanetworks/avd'
steps:
- name: Checkout AVD
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ./avd
- name: Checkout docs repo
uses: actions/checkout@v4
with:
repository: aristanetworks/avd-docs
token: ${{ secrets.DOCS_ACCESS_TOKEN }}
fetch-depth: 0
path: ./docs
- name: 'Setup Python 3 on runner'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Setup Git config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: 'Build mkdocs content and deploy to aristanetworks/avd-docs on main'
run: |
cd ./docs
pip install -r ../avd/ansible_collections/arista/avd/docs/requirements.txt
mike deploy --push -b main devel --config-file ../avd/mkdocs.yml |
Thanks @JulioPDX - feel free to add commits to this PR |
I believe you are right about snippets, let me reevaluate this solution |
@gmuloc yeah I tried it on some private repos, I think this gets us all we need with devel, since that version already exists, we can use standard git to update the directory. I'll add you to the private repos if you'd like to test. ---
# This is deploying the latest commits on devel to aristanetworks/avd-docs main branch
name: Deploy devel documentation to aristanetworks/avd-docs main
on:
push:
branches:
- devel
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
'devel_doc':
name: 'Update Public devel documentation'
runs-on: ubuntu-latest
if: github.repository == 'aristanetworks/avd'
steps:
- name: Checkout AVD
uses: actions/checkout@v4
with:
fetch-depth: 0
path: devel
- name: Checkout docs repo
uses: actions/checkout@v4
with:
repository: aristanetworks/avd-docs
token: ${{ secrets.REPO_ACCESS_TOKEN }}
fetch-depth: 0
path: docs
- name: 'Setup Python 3 on runner'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Setup Git config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: 'Build mkdocs content and deploy to aristanetworks/avd-docs on main'
run: |
cd ./devel
pip install .[doc]
mkdocs build -d ../docs/devel
cd ../docs
git add .
git commit -m "updating devel with $GITHUB_SHA"
git push
|
Closing as we agreed it would be implemented in avd-docs repo. |
@gmuloc @carlbuchmann Need your opinion on something, I got this to work using workflow dispatch, but this still requires some type of secret to be set since the docs repository is private. We would still need a dispatch workflow on the avd repo. Example below from my test repositories. On AVD:devel-doc.yml---
name: Deploy devel documentation
on:
push:
branches:
- devel
workflow_dispatch:
jobs:
'devel_doc':
name: 'Update Public devel documentation'
runs-on: ubuntu-latest
if: github.repository == 'JulioPDX/production-test'
steps:
- name: Run dispatch
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.REPO_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/JulioPDX/push-test/actions/workflows/test.yml/dispatches \
-d '{"ref":"main"}'
On docs repotest.yml---
name: Deploy devel documentation
on:
workflow_dispatch:
jobs:
'devel_doc':
name: 'Update Public devel documentation'
runs-on: ubuntu-latest
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
path: docs
- name: Checkout AVD
uses: actions/checkout@v4
with:
repository: JulioPDX/production-test
path: avd
- name: 'Setup Python 3 on runner'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Setup Git config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: 'Build mkdocs content and deploy'
run: |
cd ./avd
pip install -r requirements.txt
mkdocs build -d ../docs/devel
cd ../docs
git add .
git commit -m "updating devel with $GITHUB_SHA"
git push
|
@JulioPDX can we do without token the other way around )(avd-docs subscribing to push events on devel in main avd repo?) |
I can take a look at this option. Thank you |
Closing as this has been implemented in the docs repo. Thank you |
Change Summary
WIP
Related Issue(s)
Fixes #
Component(s) name
arista.avd.<role-name>
Proposed changes
How to test
Checklist
User Checklist
Repository Checklist