[U] Scripts
This commit is contained in:
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Stop on error
|
||||
set -e
|
||||
|
||||
# Check if package.json is present
|
||||
[[ ! -f "package.json" ]] && echo "package.json not found, please make sure you're in the correct path" && exit -1
|
||||
|
||||
# Deploy npm
|
||||
npm publish
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Stop on error
|
||||
set -e
|
||||
|
||||
# Check if setup.py is present
|
||||
[[ ! -f "setup.py" ]] && echo "Setup.py not found, please make sure you're in the correct path" && exit -1
|
||||
|
||||
# Remove old build
|
||||
rm -rf dist
|
||||
rm -rf build
|
||||
|
||||
# Build
|
||||
python setup.py sdist bdist_wheel
|
||||
|
||||
# Check built files
|
||||
twine check dist/*
|
||||
|
||||
# Upload
|
||||
twine upload dist/*
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
print('Checking git repo...')
|
||||
url = subprocess.check_output('git remote get-url origin'.split()).decode('utf-8').strip()
|
||||
|
||||
print(f'Current url: {url}')
|
||||
|
||||
if url.startswith('http'):
|
||||
print('> HTTP git remote detected, switching to SSH')
|
||||
repo = url.split('github.com/')[-1]
|
||||
if repo.endswith('.git'):
|
||||
repo = repo[:-4]
|
||||
print(f'> Repo detected: {repo}')
|
||||
new_url = f'git@github.com:{repo}.git'
|
||||
|
||||
elif url.startswith('git@'):
|
||||
# git@github.com:hykilpikonna/zshrc.git
|
||||
print('> SSH git remote detected, switching to HTTP')
|
||||
repo = url.split(':')[-1].split('.git')[0]
|
||||
print(f'> Repo detected: {repo}')
|
||||
new_url = f'https://github.com/{repo}'
|
||||
|
||||
else:
|
||||
print('Failed to detect protocol, exiting')
|
||||
exit(-1)
|
||||
|
||||
print(f'New URL: {new_url}')
|
||||
print('> Setting new url...')
|
||||
os.system(f'git remote set-url origin {new_url}')
|
||||
print('> Done!')
|
||||
Reference in New Issue
Block a user