-
Notifications
You must be signed in to change notification settings - Fork 38
79 lines (63 loc) · 2.46 KB
/
Copy pathupdate-generated-docs.yml
File metadata and controls
79 lines (63 loc) · 2.46 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: "Update Generated Docs"
on:
workflow_dispatch:
schedule:
# every day at 2am UTC
- cron: "0 2 * * *"
permissions: {}
jobs:
update_generated_docs:
runs-on: ubuntu-latest
environment: Docs generation
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- run: |
git clone https://github.com/gitbutlerapp/gitbutler ../gitbutler
- name: Compare versions
id: versions
run: |
CURRENT_DOCS_VERSION=$(cat scripts/current_docs_version.txt)
LATEST_VERSION=$(git -C ../gitbutler tag --list 'nightly/*' --sort=-version:refname | head -n 1)
echo "Current: $CURRENT_DOCS_VERSION"
echo "Latest: $LATEST_VERSION"
test -n "$LATEST_VERSION"
echo "latest_version=$LATEST_VERSION" >> "$GITHUB_OUTPUT"
if [ "$LATEST_VERSION" != "$CURRENT_DOCS_VERSION" ]; then
echo "should_update=true" >> "$GITHUB_OUTPUT"
else
echo "should_update=false" >> "$GITHUB_OUTPUT"
fi
- name: Update generated docs
if: steps.versions.outputs.should_update == 'true'
env:
LATEST_VERSION: ${{ steps.versions.outputs.latest_version }}
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev libglib2.0-dev pkg-config
git -C ../gitbutler checkout "$LATEST_VERSION"
./scripts/update-manpages.sh
echo "Updating scripts/current_docs_version.txt to $LATEST_VERSION"
echo "$LATEST_VERSION" > scripts/current_docs_version.txt
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
branch="update-generated-docs-$LATEST_VERSION"
git checkout -b "$branch"
git add .
git commit -m "Update CLI docs"
git push origin "$branch"
echo "branch=$branch" >> "$GITHUB_ENV"
- name: Create pull request
if: steps.versions.outputs.should_update == 'true'
run: |
gh pr create \
--title "Update generated CLI documentation for version ${LATEST_VERSION}" \
--body "Automatic docs update for ${LATEST_VERSION} @slarse @krlvi" \
--base main \
--head "$branch"
env:
GH_TOKEN: ${{ secrets.GH_CREATE_PR_PAT }}
LATEST_VERSION: ${{ steps.versions.outputs.latest_version }}