Skip to content

Commit 5ecd0d8

Browse files
authored
Merge pull request #5 from gioxx/dev
A few new options to make the patch release more interesting 😃
2 parents 2bd6124 + 5e98cab commit 5ecd0d8

File tree

5 files changed

+363
-52
lines changed

5 files changed

+363
-52
lines changed

.github/workflows/patch.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,33 @@ jobs:
7070
run: |
7171
OLD=${{ needs.check.outputs.old }}
7272
NEW=${{ needs.check.outputs.new }}
73-
python YOURLS-diff_CreatePackage.py --old "$OLD" --new "$NEW"
73+
python YOURLS-diff_CreatePackage.py --old "$OLD" --new "$NEW" --summary
74+
7475
env:
7576
PYTHONUNBUFFERED: '1'
7677

78+
- name: Determine which artifacts to upload
79+
id: build_artifacts
80+
run: |
81+
OLD=${{ needs.check.outputs.old }}
82+
NEW=${{ needs.check.outputs.new }}
83+
ARTIFACTS="YOURLS-update-$OLD-to-$NEW.zip YOURLS-update-$OLD-to-$NEW.txt"
84+
85+
if [ -f "YOURLS-update-$OLD-to-$NEW.removed.txt" ]; then
86+
ARTIFACTS="$ARTIFACTS YOURLS-update-$OLD-to-$NEW.removed.txt"
87+
fi
88+
89+
echo "artifact_files=$ARTIFACTS" >> $GITHUB_OUTPUT
90+
7791
- name: Create Release & Upload Patch
7892
uses: ncipollo/release-action@v1
7993
with:
8094
tag: ${{ needs.check.outputs.new }}
8195
name: "${{ needs.check.outputs.old }} to ${{ needs.check.outputs.new }}"
82-
bodyFile: YOURLS-update-${{ needs.check.outputs.old }}-to-${{ needs.check.outputs.new }}.txt
96+
bodyFile: YOURLS-update-${{ needs.check.outputs.old }}-to-${{ needs.check.outputs.new }}.summary.txt
8397
draft: false
8498
prerelease: false
85-
artifacts: |
86-
YOURLS-update-${{ needs.check.outputs.old }}-to-${{ needs.check.outputs.new }}.zip
99+
artifacts: ${{ steps.build_artifacts.outputs.artifact_files }}
87100
env:
88101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/venv
2+
/removed_backup

README.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
[Readme file is also available in italian](README_IT.md).
44

5+
![Patch Build](https://github.com/gioxx/YOURLS-diff/actions/workflows/patch.yml/badge.svg)
6+
57
**YOURLS Diff** is a Python script that simplifies updating a YOURLS installation via FTP by creating a ZIP package containing only the new or modified files between two release tags.
68

79
If you want to take advantage of the patches that are automatically created by this script and this repository (via [this GitHub Action](.github/workflows/patch.yml)), you can take a look at [Releases](https://github.com/gioxx/YOURLS-diff/releases). The most recent update package will always be available by pointing to the [Latest tag](https://github.com/gioxx/YOURLS-diff/releases/latest). The script runs every day at midnight.
810

911
## Features
1012

1113
- Automatically downloads the two ZIP archives (`old` and `new`) from the YOURLS GitHub repository.
12-
- Compares files and identifies **new** or **modified** ones.
14+
- Compares files and identifies **new**, **modified**, and **removed** files.
1315
- Generates a ZIP package containing only the changed files.
1416
- Produces an external manifest file (`.txt`) listing the changed files.
15-
- Supports SSL certificate verification with an option to disable it.
17+
- Generates a `.removed.txt` file if any files were deleted.
18+
- Creates a Bash deployment script (`.sh`) that allows you to update your YOURLS instance via rsync and SSH.
19+
- Supports SSL certificate verification with an option to disable it.
20+
- (Optional) Generates a WinSCP-compatible script (`.winscp.txt`) for Windows users to download and delete removed files via SFTP.
1621

1722
## Requirements
1823

@@ -47,12 +52,15 @@ If you want to take advantage of the patches that are automatically created by t
4752

4853
The main script is called `YOURLS-diff_CreatePackage.py` and accepts the following options:
4954

50-
| Option | Description | Example |
51-
|----------------|--------------------------------------------------------------------------|--------------------------------------|
52-
| `--old` | **(required)** Tag of the starting release (e.g., `1.8.10`). | `--old 1.8.10` |
53-
| `--new` | Tag of the target release. If omitted, `latest` is used. | `--new 1.9.0` |
54-
| `--output` | Output ZIP filename. Default: `YOURLS-update-OLD-to-NEW.zip`. | `--output diff.zip` |
55-
| `--no-verify` | Disable SSL certificate verification (not recommended). | `--no-verify` |
55+
| Option | Description | Example |
56+
|------------------|----------------------------------------------------------------------------------------------------|--------------------------------------|
57+
| `--old` | **(required)** Tag of the starting release (e.g., `1.8.10`). | `--old 1.8.10` |
58+
| `--new` | Tag of the target release. If omitted, `latest` is used. | `--new 1.9.0` |
59+
| `--output` | Output ZIP filename. Default: `YOURLS-update-OLD-to-NEW.zip`. | `--output diff.zip` |
60+
| `--no-verify` | Disable SSL certificate verification (not recommended). | `--no-verify` |
61+
| `--summary` | Generate a summary text file with patch details. | `--summary` |
62+
| `--only-removed` | Only generate the `.removed.txt` file (if any).<br>Also generates a deployment script to remove the files from the server. | `--only-removed` |
63+
| `--winscp` | Generate a `.winscp.txt` script to download and delete the removed files (requires `--only-removed`). Useful for Windows users. | `--winscp` |
5664

5765
### Examples
5866

@@ -69,11 +77,33 @@ The main script is called `YOURLS-diff_CreatePackage.py` and accepts the followi
6977
python YOURLS-diff_CreatePackage.py --old 1.8.10 --new 1.9.0 --output update.zip
7078
```
7179

80+
- **Only generate the removed file list and the deletion script**:
81+
```bash
82+
python YOURLS-diff_CreatePackage.py --old 1.8.10 --only-removed
83+
```
84+
85+
- **Include WinSCP script for removed files**:
86+
```bash
87+
python YOURLS-diff_CreatePackage.py --old 1.8.10 --only-removed --winscp
88+
```
89+
7290
- **Disable SSL verification**:
7391
```bash
7492
python YOURLS-diff_CreatePackage.py --old 1.8.10 --no-verify
7593
```
7694

95+
## Deployment Options
96+
97+
Once a patch is generated, you can deploy it to your YOURLS server using:
98+
99+
- `YOURLS-deploy-OLD-to-NEW.sh`: Bash script using rsync and ssh (for Unix/Linux users)
100+
- `YOURLS-update-OLD-to-NEW.winscp.txt`: WinSCP batch script for Windows users (with `--winscp`)
101+
- **Manual FTP upload**: Simply extract the ZIP file and upload its **contents** manually using any FTP/SFTP client (e.g., FileZilla, Cyberduck, WinSCP, Transmit).
102+
103+
Each script or method will:
104+
- Upload new or modified files (standard mode)
105+
- Remove files no longer present in the target version (automated scripts only)
106+
77107
## Repository Structure
78108

79109
```text

README_IT.md

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
# YOURLS Diff
22

3-
[Il file Readme è disponibile anche in inglese](README.md).
3+
[Il file README è disponibile anche in inglese](README.md).
44

5-
**YOURLS Diff** è uno script Python che semplifica l'aggiornamento di un'installazione YOURLS tramite FTP, creando un pacchetto ZIP con solo i file nuovi o modificati tra due tag di release.
5+
![Patch Build](https://github.com/gioxx/YOURLS-diff/actions/workflows/patch.yml/badge.svg)
66

7-
Se vuoi sfruttare le patch che vengono create automaticamente da questo script e questo repository (tramite [questa GitHub Action](.github/workflows/patch.yml)), puoi dare un'occhiata alle [Releases](https://github.com/gioxx/YOURLS-diff/releases). Il pacchetto di aggiornamento più recente sarà sempre disponibile puntando al [tag Latest](https://github.com/gioxx/YOURLS-diff/releases/latest). Lo script viene eseguito ogni giorno a mezzanotte.
7+
**YOURLS Diff** è uno script Python che semplifica l'aggiornamento di un'installazione YOURLS via FTP creando un archivio ZIP contenente solo i file nuovi o modificati tra due tag di rilascio.
8+
9+
Se vuoi approfittare delle patch create automaticamente da questo script e da questo repository (tramite [questa GitHub Action](.github/workflows/patch.yml)), puoi consultare la sezione [Releases](https://github.com/gioxx/YOURLS-diff/releases). Il pacchetto più recente sarà sempre disponibile tramite il [Latest tag](https://github.com/gioxx/YOURLS-diff/releases/latest). Lo script viene eseguito ogni giorno a mezzanotte.
810

911
## Caratteristiche
1012

1113
- Scarica automaticamente i due archivi ZIP (`old` e `new`) dal repository GitHub di YOURLS.
12-
- Confronta i file e individua quelli **nuovi** o **modificati**.
13-
- Genera un pacchetto ZIP contenente solo i file differenziati.
14-
- Produce un file manifest esterno (`.txt`) con l'elenco dei file cambiati.
15-
- Supporta la verifica SSL con possibilità di disabilitarla tramite flag.
14+
- Confronta i file e identifica quelli **nuovi**, **modificati** e **rimossi**.
15+
- Genera un pacchetto ZIP contenente solo i file modificati.
16+
- Produce un file manifest esterno (`.txt`) con l'elenco dei file modificati.
17+
- Genera un file `.removed.txt` se sono stati eliminati file nella nuova versione.
18+
- Crea uno script di deploy Bash (`.sh`) per aggiornare l'istanza YOURLS tramite rsync e SSH.
19+
- Supporta la verifica del certificato SSL con possibilità di disabilitarla.
20+
- (Opzionale) Genera uno script compatibile con WinSCP (`.winscp.txt`) per utenti Windows che vogliono scaricare ed eliminare file via SFTP.
1621

1722
## Requisiti
1823

1924
- Python **3.6+**
20-
- Librerie Python elencate in `requirements.txt`:
25+
- Librerie Python indicate in `requirements.txt`:
2126
```txt
2227
requests>=2.20.0
2328
urllib3>=1.25.0
@@ -45,45 +50,67 @@ Se vuoi sfruttare le patch che vengono create automaticamente da questo script e
4550

4651
## Utilizzo
4752

48-
Lo script principale si chiama `YOURLS-diff_CreatePackage.py` e accetta i seguenti parametri:
53+
Lo script principale si chiama `YOURLS-diff_CreatePackage.py` e accetta le seguenti opzioni:
4954

50-
| Opzione | Descrizione | Esempio |
51-
|----------------|-----------------------------------------------------------------------------|---------------------------------------|
52-
| `--old` | **(obbligatorio)** Tag della release di partenza (es. `1.8.10`). | `--old 1.8.10` |
53-
| `--new` | Tag della release di destinazione. Se omesso, viene usato `latest`. | `--new 1.9.0` |
54-
| `--output` | Nome del file ZIP di output. Default: `YOURLS-update-OLD-to-NEW.zip`. | `--output diff.zip` |
55-
| `--no-verify` | Disabilita la verifica del certificato SSL. _Non_ raccomandato. | `--no-verify` |
55+
| Opzione | Descrizione | Esempio |
56+
|-------------------|----------------------------------------------------------------------------------------------------|--------------------------------------|
57+
| `--old` | **(obbligatorio)** Tag della versione di partenza (es: `1.8.10`). | `--old 1.8.10` |
58+
| `--new` | Tag della versione di destinazione. Se omesso, viene usato `latest`. | `--new 1.9.0` |
59+
| `--output` | Nome del file ZIP in uscita. Default: `YOURLS-update-OLD-to-NEW.zip`. | `--output diff.zip` |
60+
| `--no-verify` | Disattiva la verifica SSL (non consigliato). | `--no-verify` |
61+
| `--summary` | Genera un file `.summary.txt` con il riepilogo delle modifiche. | `--summary` |
62+
| `--only-removed` | Genera solo il file `.removed.txt` (se ci sono file eliminati).<br>Genera anche lo script di rimozione remoto (`.sh`). | `--only-removed` |
63+
| `--winscp` | Genera uno script `.winscp.txt` per scaricare ed eliminare i file rimossi (richiede `--only-removed`). Utile per utenti Windows. | `--winscp` |
5664

57-
### Esempi di esecuzione
65+
### Esempi
5866

59-
- **Aggiornare da 1.8.10 all'ultima release**:
67+
- **Aggiornare dalla 1.8.10 all'ultima versione disponibile**:
6068
```bash
6169
python YOURLS-diff_CreatePackage.py --old 1.8.10
6270
```
63-
Genera:
64-
- `YOURLS-update-1.8.10-to-<latest>.zip`
65-
- `YOURLS-update-1.8.10-to-<latest>.txt` (manifest)
6671

67-
- **Aggiornare da 1.8.10 a 1.9.0 e nome personalizzato**:
72+
- **Aggiornare dalla 1.8.10 alla 1.9.0 con nome ZIP personalizzato**:
6873
```bash
6974
python YOURLS-diff_CreatePackage.py --old 1.8.10 --new 1.9.0 --output update.zip
7075
```
7176

72-
- **Disabilitare la verifica SSL**:
77+
- **Generare solo la lista dei file rimossi e lo script di rimozione**:
78+
```bash
79+
python YOURLS-diff_CreatePackage.py --old 1.8.10 --only-removed
80+
```
81+
82+
- **Includere anche lo script WinSCP per la cancellazione remota**:
83+
```bash
84+
python YOURLS-diff_CreatePackage.py --old 1.8.10 --only-removed --winscp
85+
```
86+
87+
- **Disabilitare la verifica del certificato SSL**:
7388
```bash
7489
python YOURLS-diff_CreatePackage.py --old 1.8.10 --no-verify
7590
```
7691

92+
## Opzioni di Deploy
93+
94+
Una volta generato il pacchetto, puoi effettuare il deploy sulla tua installazione YOURLS usando:
95+
96+
- `YOURLS-deploy-OLD-to-NEW.sh`: script Bash con rsync e ssh (per utenti Unix/Linux)
97+
- `YOURLS-update-OLD-to-NEW.winscp.txt`: script batch per WinSCP (Windows, con `--winscp`)
98+
- **Upload manuale via FTP**: Estrai il contenuto del file ZIP e caricalo manualmente utilizzando qualsiasi client FTP/SFTP (es: FileZilla, Cyberduck, WinSCP, Transmit).
99+
100+
Ogni metodo/script ti consente di:
101+
- Caricare i file modificati o aggiunti (in modalità standard)
102+
- Rimuovere i file non più presenti nella nuova versione (solo con script automatici)
103+
77104
## Struttura del repository
78105

79106
```text
80107
├── YOURLS-diff_CreatePackage.py # Script Python principale
81108
├── requirements.txt # Dipendenze Python
82-
├── LICENSE # La licenza utilizzata per questo repository
83-
├── README.md # Questa documentazione, in inglese
84-
└── README_IT.md # Questa documentazione
109+
├── LICENSE # Licenza del progetto
110+
├── README.md # Documentazione in inglese
111+
└── README_IT.md # Documentazione in italiano
85112
```
86113

87114
## Contribuire
88115

89-
Pull request e segnalazioni di issue sono benvenute! Per favore apri una nuova issue per bug o feature request.
116+
Sono ben accetti Pull Request e segnalazioni di bug! Apri una issue per segnalazioni o proposte di nuove funzionalità.

0 commit comments

Comments
 (0)