Skip to content

Commit

Permalink
Merge pull request #3 from Falcion/development
Browse files Browse the repository at this point in the history
chores(git): update shields in README and add new
  • Loading branch information
Falcion authored Sep 14, 2023
2 parents eab6696 + 17744f0 commit 11274cc
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Checker of release tags

on:
release:
types:
- created

jobs:
check-release-tag:
runs-on: ubuntu-latest
steps:
- name: Check tag prefixes
run: |
# Extract the tag name from the event payload
TAG_NAME=$(jq -r '.release.tag_name' "$GITHUB_EVENT_PATH")
# Check if the tag starts with "v"
if [[ "$TAG_NAME" == v* ]]; then
TAG_NAME_NO_V="${TAG_NAME#v}" # Remove "v" prefix
if git rev-parse --quiet --verify "refs/tags/$TAG_NAME_NO_V"; then
echo "Tag without 'v' already exists: $TAG_NAME_NO_V"
else
echo "Creating tag without 'v': $TAG_NAME_NO_V"
git tag "$TAG_NAME_NO_V" "$GITHUB_SHA"
git push origin "$TAG_NAME_NO_V"
fi
else
TAG_NAME_WITH_V="v$TAG_NAME" # Add "v" prefix
if git rev-parse --quiet --verify "refs/tags/$TAG_NAME_WITH_V"; then
echo "Tag with 'v' already exists: $TAG_NAME_WITH_V"
else
echo "Creating tag with 'v': $TAG_NAME_WITH_V"
git tag "$TAG_NAME_WITH_V" "$GITHUB_SHA"
git push origin "$TAG_NAME_WITH_V"
fi
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<a href="https://github.com/Falcion/UnitadeOBSIDIAN/forks"><img src="https://img.shields.io/github/forks/Falcion/UnitadeOBSIDIAN" alt="forks"/></a>
<a href="https://github.com/Falcion/UnitadeOBSIDIAN/issues"><img src="https://img.shields.io/github/issues/Falcion/UnitadeOBSIDIAN" alt="issues"/></a>
<a href="https://github.com/Falcion/UnitadeOBSIDIAN/commits"><img src="https://img.shields.io/github/last-commit/Falcion/UnitadeOBSIDIAN" alt="commit-activity"/></a>
<a href="https://obsidian.md/plugins?search=unitade"><img src="https://img.shields.io/github/downloads/Falcion/UnitadeOBSIDIAN/total" alt="downloads"/></a>
<a href="https://github.com/Falcion/UnitadeOBSDIAIN/releases"><img src="https://img.shields.io/github/manifest-json/v/Falcion/UnitadeOBSIDIAN" alt="version"/></a>
</div>
<br/>
<div align="center">
Expand Down
37 changes: 37 additions & 0 deletions scripts/clonesource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import shutil
import os

def confirm_copy():
while True:
response = input("Do you want to copy the files? (y/n): ").strip().lower()
if response in ("y", "n"):
return response == "y"
else:
print("Invalid input. Please enter 'y' or 'n'.")

# Define the source and destination paths
source_dir = "." # Root directory
destination_dir = "source" # Destination folder

# List of files to copy
files_to_copy = ["main.ts", "manifest.json"]

# Ensure the destination directory exists
if not os.path.exists(destination_dir):
os.makedirs(destination_dir)

if confirm_copy():
# Copy each file to the destination directory
for file_name in files_to_copy:
source_path = os.path.join(source_dir, file_name)
destination_path = os.path.join(destination_dir, file_name)

try:
shutil.copy(source_path, destination_path)
print(f"Copied {file_name} to {destination_dir}")
except FileNotFoundError:
print(f"File {file_name} not found in the root directory.")

print("Copy process completed.")
else:
print("Copy process aborted.")
12 changes: 9 additions & 3 deletions scripts/pack.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import os
import zipfile

<<<<<<< Updated upstream
index_js_path = 'out/main.js'
manifest_path = 'manifest.json'
output_zip_path = 'out/plugins-output.zip'
=======
index_js_path = "out/main.js"
manifest_path = "manifest.json"
output_zip_path = "out/plugins-output.zip"
>>>>>>> Stashed changes

# Check if the required files exist
if not os.path.exists(index_js_path):
Expand All @@ -17,8 +23,8 @@
os.makedirs(os.path.dirname(output_zip_path), exist_ok=True)

# Create a new ZIP archive
with zipfile.ZipFile(output_zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
zipf.write(index_js_path, arcname='main.js')
zipf.write(manifest_path, arcname='manifest.json')
with zipfile.ZipFile(output_zip_path, "w", zipfile.ZIP_DEFLATED) as zipf:
zipf.write(index_js_path, arcname="main.js")
zipf.write(manifest_path, arcname="manifest.json")

print(f"ZIP archive created at {output_zip_path}")

0 comments on commit 11274cc

Please sign in to comment.