-
Notifications
You must be signed in to change notification settings - Fork 15
62 lines (54 loc) · 1.97 KB
/
release-docs-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Release Update Ockam Docs
permissions:
contents: read
on:
workflow_dispatch:
inputs:
ockam_ref:
description: Ockam branch to update repository
required: true
branch_name:
description: Branch name to create pull request
required: true
jobs:
release_update_docs:
name: Release - update documentation
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout Docs Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0
path: docs
- name: Checkout Ockam Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
path: examples
repository: build-trust/ockam
ref: ${{ github.event.inputs.ockam_ref }}
- name: Update Examples
working-directory: docs
run: |
branch_name="docs_${{ github.event.inputs.branch_name }}"
if git ls-remote --heads origin "$branch_name" | grep -q "$branch_name"; then
echo "Branch $branch_name exists, switching to it..."
git branch
git checkout "$branch_name"
else
echo "Branch $branch_name doesn't exist, creating a new branch..."
git checkout -b "$branch_name"
fi
DOCS_HOME="${GITHUB_WORKSPACE}/docs" OCKAM_HOME="${GITHUB_WORKSPACE}/examples" ${GITHUB_WORKSPACE}/examples/tools/docs/update_md.sh
- name: Push Changes
working-directory: docs
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# Check if there are updated files
if ! git diff --exit-code; then
git add .
git commit -m "update docs on release to ockam ref ${{ github.event.inputs.ockam_ref }}"
git push --set-upstream origin "docs_${{ github.event.inputs.branch_name }}"
fi