forked from outscale/terraform-provider-outscale
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github Action to generate documentation on dispatch trigger
- Loading branch information
1 parent
69eab89
commit 14c4823
Showing
6 changed files
with
97 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DOC_TEMPLATE_SUBMODULE="docs/doc-terraform-template" | ||
|
||
if [ "$TAG" == "" ]; then | ||
echo "We need the tag of the doc" | ||
exit 1 | ||
fi | ||
|
||
# Create a branch | ||
git checkout -b "autobuild-Documentation-$TAG" | ||
|
||
# Update submodule | ||
(cd $DOC_TEMPLATE_SUBMODULE && git fetch && git checkout $TAG) | ||
|
||
# Gen the doc | ||
make doc | ||
|
||
# Create PR | ||
git config user.name "Outscale Bot" | ||
git config user.email "[email protected]" | ||
|
||
git add $DOC_TEMPLATE_SUBMODULE | ||
git add website/* | ||
|
||
git commit -sm "Release Documentation $TAG" |
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,19 @@ | ||
#!/bin/env bash | ||
set -e | ||
|
||
if [ -z "$GH_BOT_TOKEN" ]; then | ||
echo "GH_BOT_TOKEN is missing, abort." | ||
exit 1 | ||
fi | ||
|
||
# https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls#create-a-pull-request | ||
result=$(curl -s -X POST -H "Authorization: token $GH_BOT_TOKEN" -d "{\"head\":\"autobuild-Documentation-$TAG\",\"base\":\"master\",\"title\":\"Documentation $TAG\",\"body\":\"Automatic generation of the documentation $TAG\"}" "https://api.github.com/repos/outscale-mdr/terraform-provider-outscale/pulls") | ||
|
||
errors=$(echo $result | jq .errors) | ||
|
||
echo $errors | ||
|
||
if [ "$errors" != "null" ]; then | ||
echo "errors while creating pull request, abort." | ||
exit 1 | ||
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,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$TAG" == "" ]; then | ||
echo "We need the tag of the doc" | ||
exit 1 | ||
fi | ||
|
||
if [ "$SSH_PRIVATE_KEY" == "" ]; then | ||
echo "We need the SSH key of the bot" | ||
exit 1 | ||
fi | ||
|
||
echo "$SSH_PRIVATE_KEY" > bot.key | ||
chmod 600 bot.key | ||
GIT_SSH_COMMAND="ssh -i bot.key" git push -f origin "autobuild-Documentation-$TAG" |
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,31 @@ | ||
name: Generate documentation | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'doc template tag repository' | ||
required: true | ||
|
||
jobs: | ||
doc-release: | ||
environment: auto-build | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
- uses: actions/setup-python@v2 | ||
- name: auto-generate release | ||
run: .github/scripts/doc-build.sh | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
- name: push release branch | ||
run: .github/scripts/doc-push.sh | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
TAG: ${{ github.event.inputs.tag }} | ||
- name: create pull request | ||
run: .github/scripts/doc-pr.sh | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }} |
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
Submodule doc-terraform-template
updated
from ee3d6b to b2d4a7