Skip to content

Commit 2aff95b

Browse files
authored
ci: init ssh outside of action (#1377)
This change finally should set up the ssh instance in the worker node to publish correctly the generated documentation Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
1 parent 41e9c3d commit 2aff95b

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

.github/actions/doc-publish/action.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,21 @@ inputs:
2323
docs:
2424
description: "The docs project location."
2525
required: true
26-
publish-key:
27-
description: "SSH deploy key for pushing docs."
28-
required: true
2926

3027
runs:
3128
using: "composite"
3229
steps:
33-
- name: Setup SSH
34-
uses: webfactory/ssh-agent@v0.10.0
35-
with:
36-
ssh-private-key: ${{ inputs.publish-key }}
3730
- name: Commit files
3831
working-directory: ${{ inputs.docs }}
3932
shell: bash
4033
run: |
4134
git config --local user.email "edgehog-machine@ispirata.com"
4235
git config --local user.name "Edgehog Bot"
4336
git add .
37+
if git diff --cached --quiet; then
38+
echo "No documentation changes to commit."
39+
exit 0
40+
fi
4441
git commit -m "Update Documentation"
4542
- name: Push changes
4643
working-directory: ${{ inputs.docs }}

.github/workflows/docs-ci.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,14 @@ jobs:
8787
docs: docs
8888
astarte-interfaces: edgehog-astarte-interfaces
8989
version: ${{ steps.compute-version.outputs.version }}
90+
- name: Setup SSH
91+
if: ${{ inputs.publish }}
92+
run: |
93+
eval `ssh-agent -t 300 -s`
94+
echo "${{ secrets.publish-key }}" | ssh-add -
95+
mkdir -p ~/.ssh/
96+
ssh-keyscan github.com >> ~/.ssh/known_hosts
9097
- uses: ./edgehog/.github/actions/doc-publish
9198
if: ${{ inputs.publish }}
9299
with:
93100
docs: docs
94-
publish-key: ${{ secrets.publish-key }}

0 commit comments

Comments
 (0)