Add Additional Command Buttons (#117) #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: (on push) zip upload | |
on: | |
push: | |
paths: | |
- 'Working/**' | |
jobs: | |
zip-files: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Analyse changed plugins | |
id: files | |
uses: tj-actions/[email protected] | |
with: | |
separator: '%%%' | |
- name: Zip changed plugins | |
run: | | |
import os | |
import subprocess | |
changed = "${{ steps.files.outputs.all_changed_and_modified_files }}" | |
plugins = set() | |
for f in changed.split("%%%"): | |
if not "Working" in f: | |
continue | |
path = f.split(os.sep) | |
index = path.index("Working") + 1 | |
if index >= len(path): | |
continue | |
plugins.add(path[index]) | |
if plugins: | |
print("The following plugins have changed:") | |
for p in plugins: | |
print(p) | |
os.chdir('Working') | |
corrected = p.replace(" ", ".") | |
corrected = corrected.replace("'", ".") | |
corrected = corrected.replace(",", ".") | |
corrected = corrected.replace("(", ".") | |
corrected = corrected.replace(")", ".") | |
corrected = corrected.replace("&", ".") | |
corrected = corrected.replace(",", ".") | |
corrected = corrected.replace("...", ".") | |
corrected = corrected.replace("..", ".") | |
if corrected[len(corrected)-1] == ".": | |
corrected = corrected[:len(corrected)-1] | |
subprocess.run(["zip", "-r", "../" + corrected + ".zip", p], | |
stdout=subprocess.DEVNULL) | |
os.chdir('../') | |
else: | |
print("No plugin changes have been detected.") | |
shell: python | |
- name: Upload plugins to release | |
uses: ncipollo/[email protected] | |
with: | |
name: Downloads | |
tag: Latest | |
allowUpdates: true | |
replacesArtifacts: true | |
updateOnlyUnreleased: false | |
artifacts: "*.zip" | |
- name: delete zips in root | |
run: | | |
import os | |
import glob | |
listing = glob.glob('*.zip') | |
for entry in listing: | |
os.remove(entry) | |
print("removed: " + entry) | |
shell: python | |
- name: Commit file | |
run: | | |
git config user.name "script" | |
git config user.email "<>" | |
git add . | |
git commit -m "Plugins added" || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true |