Skip to content

Commit 3ff3ab3

Browse files
authored
make ftp have ip configured in the file and draft release in workflow (#4)
1 parent 82a1d81 commit 3ff3ab3

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ jobs:
3838
run: |
3939
just lintc
4040
if [[ $? -ne 0 ]]; then echo "Run just format to fix"; fi
41+
- name: Release | Draft Release Notes
42+
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
43+
run: |
44+
just draft-release > RELEASE_NOTES.txt
45+
cp standalont_ftp.py ftp.py
46+
- name: Release | Create Draft Release
47+
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
48+
uses: softprops/action-gh-release@v1
49+
with:
50+
draft: true
51+
body_path: RELEASE_NOTES.txt
52+
files: |
53+
ftp.py

Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ ftp COMMAND="install":
9292

9393
# Run standalone ftp util wrapper for sending restore state.
9494
send-restore:
95-
@if [[ -z ${SWITCH_CONSOLE_IP:+x} ]] ; then python3 tools/ftp.py install; else python3 standalone_ftp.py $SWITCH_CONSOLE_IP runtime/restore.txt set ; fi
95+
@if [[ -z ${SWITCH_CONSOLE_IP:+x} ]] ; then python3 tools/ftp.py install; else python3 standalone_ftp.py runtime/restore.txt set -ip $SWITCH_CONSOLE_IP ; fi
9696

9797
# Run standalone ftp util wrapper for getting latest state.
9898
get-latest:
99-
@if [[ -z ${SWITCH_CONSOLE_IP:+x} ]] ; then python3 tools/ftp.py install; else python3 standalone_ftp.py $SWITCH_CONSOLE_IP runtime/latest.txt get ; fi
99+
@if [[ -z ${SWITCH_CONSOLE_IP:+x} ]] ; then python3 tools/ftp.py install; else python3 standalone_ftp.py runtime/latest.txt get -ip $SWITCH_CONSOLE_IP ; fi
100100

101101
# Search for symbol in dumpped (debug) build
102102
find-symbol SYMBOL:

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ You need to lower the setting level to restore!
109109
```
110110

111111
### Save State Transfer Script
112-
A python script `ftp.py` is also included for transfering save state files over FTP (with the `ftpd` homebrew app). Run `python3 ftp.py` to see how to use
112+
A python script `ftp.py` is also included for transfering save state files over FTP (with the `ftpd` homebrew app). Run `python3 ftp.py` to see how to use.
113+
114+
(This has nothing to do in game, just makes managing the save state files generated by the mod easier)
113115

114116
## Developer
115117
**This section is intented for developers**

standalone_ftp.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
from os.path import isfile
44
import sys
55

6+
# Change this to whatever your IP is shown in ftpd, can also use -ip option
7+
YOUR_IP = "192.168.0.123"
8+
69
def print_usage():
710
"""Print usage"""
8-
print(f"Usage: {sys.argv[0]} ip file <get|set>")
9-
print("ip = your console's ip, like 192.168.0.123")
11+
print(f"Usage: {sys.argv[0]} file <get|set>")
1012
print("file = file name of the input for set, or output for get")
1113
print("<get|set> = get: download the latest save state from switch")
1214
print(" set: send input file to switch for restoring save state")
1315
print()
14-
print(f"Example: {sys.argv[0]} 192.168.0.123 inside_bombs.txt set")
16+
print(f"You also need to open {sys.argv[0]} and change YOUR_IP to your console's IP address")
17+
print()
18+
print(f"Example: {sys.argv[0]} inside_bombs.txt set")
1519
print(" ^ This will send inside_bombs.txt to your switch for restoring")
16-
print(f"Example: {sys.argv[0]} 192.168.0.123 output_state.txt get")
20+
print(f"Example: {sys.argv[0]} output_state.txt get")
1721
print(" ^ This will download the last save state from switch and save it as output_state.txt on your computer")
1822
def run(console_ip, local_path, command):
1923
"""Main"""
@@ -87,7 +91,11 @@ def add_slash_if_need(path):
8791
return path if path.startswith("/") else "/"+path
8892

8993
if __name__ == "__main__":
90-
if len(sys.argv) < 4:
94+
if len(sys.argv) < 3:
9195
print_usage()
9296
sys.exit(-1)
93-
run(sys.argv[1], sys.argv[2], sys.argv[3])
97+
ip = YOUR_IP
98+
for i, arg in enumerate(sys.argv):
99+
if arg[i] == "-ip":
100+
ip = arg[i+1]
101+
run(ip, sys.argv[1], sys.argv[2])

0 commit comments

Comments
 (0)