-
Notifications
You must be signed in to change notification settings - Fork 7
45 lines (40 loc) · 1.25 KB
/
nightly-deploy.yaml
File metadata and controls
45 lines (40 loc) · 1.25 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
name: Trigger Netlify Build
on:
workflow_dispatch: {}
jobs:
sync:
name: Sync content and deploy
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: true
- name: Setup Git User to GitHub Action bot
uses: fregante/setup-git-user@v2
- name: Update Content Submodule
id: update
run: |
# Update the submodule
git submodule update --remote content/en/docs
# Stage changes and check status
GIT_STATUS=$(git status -s)
if [ -n "$GIT_STATUS" ]; then PUSH_AND_SYNC='true' ; fi
echo "PUSH_AND_SYNC=${PUSH_AND_SYNC}" >> $GITHUB_OUTPUT
- name: Create a commit and push if needed
if: ${{ steps.update.outputs.PUSH_AND_SYNC }}
run: |
# Create a commit and push it
git add -u
git commit -m "Update content/en/docs"
git push
- name: Trigger a Netlify Build
if: ${{ steps.update.outputs.PUSH_AND_SYNC }}
env:
NETLIFY_BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}
run: |
curl -X POST -d {} $NETLIFY_BUILD_HOOK