-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (69 loc) · 2.46 KB
/
deploy_and_update_submodules.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Update Submodules and Publish Docs
on:
push:
branches:
- main
repository_dispatch:
types:
- update-docs
workflow_dispatch: # Allows manual triggering of the workflow from the Actions tab
jobs:
update-submodules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive # Recursively checkout submodules
- name: Display Git Status
run: git status
- name: Display Submodule Info
run: git submodule status --recursive
- name: Set up Git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: Fetch Submodule Branches
run: |
git submodule foreach --recursive 'git fetch --all'
git submodule update --init --remote --recursive
git submodule foreach --recursive 'git fetch origin +refs/heads/*:refs/remotes/origin/*'
# - name: Fetch Submodule Branches
# run: git submodule foreach --recursive 'git fetch origin +refs/heads/*:refs/remotes/origin/*'
- name: Debugging - List all branches
run: |
echo "Main repository branches:"
git branch -r
echo "Submodule branches:"
git submodule foreach --recursive 'git branch -r'
- name: Update submodules
id: update_submodules
run: |
git submodule sync --recursive
git submodule update --remote --recursive
git diff --quiet || echo "Submodules changed" && echo "::set-output name=changed::true"
- name: Verify submodule files
run: |
ls -R docs/Submodules/IntelOwl
cat docs/Submodules/IntelOwl/old-docs/source/schema.yml || true
- name: Check for changes
id: check_changes
run: |
if [[ "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_ENV
else
echo "changes=false" >> $GITHUB_ENV
fi
- name: Commit and push submodule changes
if: env.changes == 'true'
run: |
git add .
git commit -m "Update submodules"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REQUIREMENTS: requirements.txt