-
-
Notifications
You must be signed in to change notification settings - Fork 46
44 lines (36 loc) · 1.39 KB
/
update-gitbook.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
name: Update GitBook Documentation with Latest Version
on:
release:
types: [created]
workflow_dispatch: # Allows manual triggering
jobs:
update-gitbook:
runs-on: ubuntu-latest
steps:
- name: Checkout core repository
uses: actions/checkout@v3
- name: Get latest release tag from GitHub API
id: get_latest_release
run: |
LATEST_TAG=$(curl -s https://api.github.com/repos/Revxrsal/lamp/releases/latest | jq -r .tag_name)
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
- name: Clone GitBook repository
run: |
git clone https://github.com/Revxrsal/lamp-docs.git
cd lamp-docs
- name: Update version in README.md
run: |
cd lamp-docs
sed -i 's/[VERSION]/${{ env.LATEST_TAG }}/g' README.md
- name: Commit and push changes to GitBook repo
run: |
cd lamp-docs
git config --local user.name "GitHub Action"
git config --local user.email "${{ secrets.EMAIL }}"
git config --local user.password "${{ secrets.PAT }}"
git add README.md
git commit -m "Update documentation with version ${{ env.LATEST_TAG }}"
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/Revxrsal/lamp-docs.git
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}