-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (31 loc) · 1.12 KB
/
create-user.yml
File metadata and controls
39 lines (31 loc) · 1.12 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
name: create user script
#when the create_user.sh is updated in the repo it will update the copy on the server
on:
push:
branches:
- main
paths:
- "New-User-Creator/create_user.sh"
#allows manual triggering of the workflow
workflow_dispatch:
#replaces the old create_user.sh with the new one in the repo
jobs:
update_script:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Replace local create_user.sh
run: |
NEW_SCRIPT_PATH="${{ github.workspace }}/New-User-Creator/create_user.sh"
LOCAL_SCRIPT_PATH="/usr/local/bin/create_user.sh"
if [ -f "$NEW_SCRIPT_PATH" ]; then
sudo /usr/bin/cp "$NEW_SCRIPT_PATH" "$LOCAL_SCRIPT_PATH"
sudo /usr/bin/chmod +x "$LOCAL_SCRIPT_PATH"
echo "create_user.sh updated successfully in $LOCAL_SCRIPT_PATH"
else
echo "Error: create_user.sh not found in repo folder!"
exit 1
fi
- name: Log update
run: echo "create_user.sh has been replaced with the latest version from the repo."