Skip to content

Commit f5587ed

Browse files
authored
Merge pull request #61 from mrikirill/feature/release-action-install-update
GitHub Actions workflow for release process
2 parents bfae626 + cb89970 commit f5587ed

3 files changed

Lines changed: 86 additions & 30 deletions

File tree

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g. 1.0.0)'
8+
required: true
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Validate composer.json
20+
run: composer validate
21+
22+
- name: Cache Composer packages
23+
id: composer-cache
24+
uses: actions/cache@v3
25+
with:
26+
path: vendor
27+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-php-
30+
31+
- name: Install dependencies
32+
run: composer install --prefer-dist --no-progress
33+
34+
- name: Run test suite
35+
run: vendor/bin/phpunit tests
36+
37+
release:
38+
needs: test
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Update version in cloudflare.php
45+
run: sed -i "s/@version .*/@version ${{ github.event.inputs.version }}/" cloudflare.php
46+
47+
- name: Create Release
48+
uses: softprops/action-gh-release@v1
49+
with:
50+
tag_name: v${{ github.event.inputs.version }}
51+
name: Release v${{ github.event.inputs.version }}
52+
files: cloudflare.php
53+
generate_release_notes: true

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
> Documentation website: https://mrikirill.github.io/SynologyDDNSCloudflareMultidomain/
77
>
88
> [![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)
9-
10-
📢 *Check out the new native version of this agent, written in Kotlin -> [KTSynologyDDNSCloudflareMultidomain](https://github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain)*
9+
>
10+
> 📢 **Check out the new native version of this agent, written in Kotlin -> [KTSynologyDDNSCloudflareMultidomain](https://github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain)**
1111
1212
## Table of contents
1313

@@ -81,7 +81,24 @@ For assistance with vi commands, see:
8181

8282
## How to install
8383

84-
### Method 1: via SSH
84+
### Method 1: via Task Scheduler (Recommended - No SSH required)
85+
86+
1. Open **Control Panel** > **Task Scheduler**.
87+
2. Click **Create** > **Scheduled Task** > **User-defined script**.
88+
3. In the **General** tab:
89+
* **Task**: Install Cloudflare DDNS
90+
* **User**: `root` **(Important!)**
91+
* Uncheck "Enabled" (we only need to run this once).
92+
4. In the **Task Settings** tab:
93+
* **Run command**:
94+
```bash
95+
wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/install.sh -O /tmp/install.sh && bash /tmp/install.sh
96+
```
97+
5. Click **OK**.
98+
6. Select the newly created task and click **Run**.
99+
7. Once the task has finished (you can check via Action > View Result), you can delete the task.
100+
101+
### Method 2: via SSH
85102

86103
1. **SSH with root privileges on your supported device:**
87104

@@ -109,8 +126,11 @@ For assistance with vi commands, see:
109126
```
110127
111128
**Note:** For SRM users, you must connect to your device as root. No other username will allow these commands to run.
129+
**Don't forget to deactivate SSH (step 1) if you don't need it.** Leaving it active can be a security risk.
112130
113-
3. **Update your DDNS settings:**
131+
### Configure DDNS (Required for both methods)
132+
133+
**Update your DDNS settings:**
114134
115135
a. *For DSM Users:* Navigate to __Control Panel > External Access > DDNS__ then add new DDNS
116136
@@ -132,26 +152,7 @@ For multiple domains: __subdomain.mydomain.com|vpn.mydomain.com__
132152
133153
Finally, press the test connection button to confirm all information is correctly entered, before pressing Ok to save and confirm your details.
134154
135-
4. Don't forget to deactivate SSH (step 1) if you don't need it. Leaving it active can be a security risk.
136-
5. You're done! Optional, if you're happy with this script you could buy me ☕ or 🍺 here -> [![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)
137-
138-
### Method 2: via Task Scheduler (No SSH required)
139-
140-
1. Open **Control Panel** > **Task Scheduler**.
141-
2. Click **Create** > **Scheduled Task** > **User-defined script**.
142-
3. In the **General** tab:
143-
* **Task**: Install Cloudflare DDNS
144-
* **User**: `root` **(Important!)**
145-
* Uncheck "Enabled" (we only need to run this once).
146-
4. In the **Task Settings** tab:
147-
* **Run command**:
148-
```bash
149-
wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/install.sh -O /tmp/install.sh && bash /tmp/install.sh
150-
```
151-
5. Click **OK**.
152-
6. Select the newly created task and click **Run**.
153-
7. Once the task has finished (you can check via Action > View Result), you can delete the task.
154-
8. Proceed to **Step 3** in Method 1 above to configure the DDNS settings in Control Panel.
155+
4. You're done! Optional, if you're happy with this script you could buy me ☕ or 🍺 here -> [![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)
155156
156157
## Troubleshooting and known issues
157158

install.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Define constants
4-
PHP_FILE_URL="https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/cloudflare.php"
4+
PHP_FILE_URL="https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/releases/latest/download/cloudflare.php"
55
PHP_FILE_DEST="/usr/syno/bin/ddns/cloudflare.php"
66
TEMP_FILE="/tmp/cloudflare.php"
77
DDNS_PROVIDER_CONF="/etc.defaults/ddns_provider.conf"
@@ -24,14 +24,16 @@ print_message "Changing permissions of cloudflare.php..."
2424
sudo chmod 755 $PHP_FILE_DEST
2525

2626
# Step 4: Insert Cloudflare configuration into ddns_provider.conf
27-
print_message "Adding Cloudflare configuration to ddns_provider.conf..."
27+
print_message "Updating Cloudflare configuration in ddns_provider.conf..."
2828
if grep -q "\[Cloudflare\]" $DDNS_PROVIDER_CONF; then
29-
print_message "Cloudflare configuration already exists in ddns_provider.conf. Skipping..."
30-
else
31-
sudo bash -c "echo -e \"$CLOUDFLARE_ENTRY\" >> $DDNS_PROVIDER_CONF"
32-
print_message "Cloudflare configuration added successfully."
29+
print_message "Removing old Cloudflare configuration..."
30+
sudo sed -i '/^\[Cloudflare\]/,/^\[/ { /^\[Cloudflare\]/d; /^\[/!d; }' "$DDNS_PROVIDER_CONF"
3331
fi
3432

33+
print_message "Adding new Cloudflare configuration..."
34+
sudo bash -c "echo -e \"$CLOUDFLARE_ENTRY\" >> $DDNS_PROVIDER_CONF"
35+
print_message "Cloudflare configuration updated successfully."
36+
3537
# Clean up temporary file
3638
rm $TEMP_FILE
3739

0 commit comments

Comments
 (0)