Compare commits
9 Commits
0defe68db8
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| d8c2b4dfa8 | |||
| 5b71ebf994 | |||
| 0cf501af3b | |||
| ba79226be6 | |||
| 37a147b4ad | |||
| bfab1bbc43 | |||
| da1ff9f82d | |||
| 128fbdb236 | |||
| 49ac141adb |
21
.gitea/workflows/auto-rebase.yml
Normal file
21
.gitea/workflows/auto-rebase.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Rebase Remote Branches
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
# Disable multiple workflows at the same time
|
||||
concurrency:
|
||||
group: ${{ github.head_ref || github.ref_name }}
|
||||
|
||||
jobs:
|
||||
rebase-branches:
|
||||
runs-on: skydust-runner
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Rebase
|
||||
uses: https://gitea.skydust.fr/actions/auto-rebase@main
|
||||
56
.gitea/workflows/production.yml
Normal file
56
.gitea/workflows/production.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
# This defines the name of the workflow as it will appear in the "Actions" tab of the Gitea repository.
|
||||
name: Production deployment
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
HOMEBREW_REPO: "https://gitea.skydust.fr/Skydust/homebrew-clearscript.git"
|
||||
|
||||
jobs:
|
||||
build-docker:
|
||||
name: Building and pushing
|
||||
runs-on: skydust-runner
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Check out repo's default branch
|
||||
uses: actions/checkout@v4
|
||||
- name: Getting version
|
||||
uses: https://gitea.skydust.fr/actions/get-version@main
|
||||
- name: Update package version
|
||||
run: |
|
||||
log_info "Updating version in version.sh to $(yellow)$NEW_VERSION"
|
||||
sed -Ei "s|^(Version=\")[^\"]*|\1${NEW_VERSION}|" Clear.sh
|
||||
mkdir dist/ && cp -v Clear.sh README.md dist/
|
||||
- name: Publishing app version
|
||||
uses: https://gitea.skydust.fr/actions/publish-skydust-app@main
|
||||
with:
|
||||
appName: "brew-clearscript"
|
||||
publishFolder: "./dist"
|
||||
- name: Update homebrew repo
|
||||
run: |
|
||||
log_info "Shallow cloning the brew repo $(yellow)${HOMEBREW_REPO}"
|
||||
git clone --depth 1 "${HOMEBREW_REPO}" ./brew_repo/
|
||||
cd brew_repo/
|
||||
|
||||
log_info "Modifying brew version"
|
||||
sed -Ei "s|(url \")[^\"]*|\1${PKG_URL}|" Formula/clearscript.rb
|
||||
sed -Ei "s|(sha256 \")[^\"]*|\1${PKG_SHA}|" Formula/clearscript.rb
|
||||
cat Formula/clearscript.rb
|
||||
echo
|
||||
|
||||
git config user.email "release@example.com"
|
||||
git config user.name "Release"
|
||||
|
||||
log_info "Overriding git repository auth with PAT"
|
||||
repo_url="$(git remote get-url origin)"
|
||||
repo_url="${repo_url#https://}" # Remove HTTPS
|
||||
GIT_NEW_URL="https://MilaBot:${{ secrets.CI_TOKEN }}@${repo_url}"
|
||||
git remote set-url origin "$GIT_NEW_URL"
|
||||
|
||||
log_info "Pushing the new version"
|
||||
git add Formula
|
||||
git commit -m "Updated version to v${NEW_VERSION}"
|
||||
git push
|
||||
23
.gitea/workflows/release.yml
Normal file
23
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
semver:
|
||||
type: choice
|
||||
description: Choose the semver
|
||||
options:
|
||||
- "Major - Incompatible API changes"
|
||||
- "Minor - Adding functionality in a backward compatible manner"
|
||||
- "Patch - Backward compatible bug fixes"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: skydust-runner
|
||||
steps:
|
||||
- name: Release
|
||||
uses: https://gitea.skydust.fr/actions/create-release@main
|
||||
with:
|
||||
semver: ${{ inputs.semver }}
|
||||
token: ${{ secrets.CI_TOKEN }}
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.idea
|
||||
.DS_Store
|
||||
30
Clear.sh
30
Clear.sh
@@ -79,7 +79,7 @@ addJob() {
|
||||
|
||||
jobSteps["$name"]="$step"
|
||||
|
||||
if [[ -z $jobCategories["$category"] ]]; then
|
||||
if [[ -z "${jobCategories["$category"]}" ]]; then
|
||||
jobCategories["$category"]="$name"
|
||||
else
|
||||
jobCategories["$category"]+="\n$name"
|
||||
@@ -150,8 +150,8 @@ addClearedVal() {
|
||||
clearFolderNew() {
|
||||
local folderPath="$2"
|
||||
local clearableName="$1"
|
||||
|
||||
jobTitle "$clearableName"
|
||||
|
||||
jobTitle "$clearableName"
|
||||
echo "Checking for ${ClearableNameColor}${clearableName}${Color_Off}'s cache folder..."
|
||||
|
||||
if [ -n "$(find "${folderPath}" -mindepth 1 -maxdepth 1 2>/dev/null)" ];
|
||||
@@ -177,14 +177,16 @@ runJobs() {
|
||||
# Elevate permissions...
|
||||
asksudo
|
||||
|
||||
# shellcheck disable=SC2296
|
||||
for category in ${(k)jobCategories}; do
|
||||
echo
|
||||
echo "${BarColor}[ --====-- $CategoryColor$category${BarColor} --====-- ]${Color_Off}"
|
||||
|
||||
echo "$jobCategories[$category]" | while IFS= read -r jobName; do
|
||||
echo "${jobCategories[$category]}" | while IFS= read -r jobName; do
|
||||
if [[ "${jobEnabled["\"$jobName\""]}" = true ]]; then
|
||||
local step=$jobSteps["$jobName"]
|
||||
local step=${jobSteps["$jobName"]}
|
||||
|
||||
# shellcheck disable=SC2296
|
||||
if print -l ${(ok)functions} | grep -q "^$step$"; then
|
||||
jobTitle "$jobName"
|
||||
# Running the custom job function
|
||||
@@ -207,6 +209,7 @@ read_config_file() {
|
||||
fi
|
||||
|
||||
while IFS= read -r line; do
|
||||
# shellcheck disable=SC2296
|
||||
parts=(${(s/=/)line})
|
||||
|
||||
configKey=${parts[1]}
|
||||
@@ -220,6 +223,7 @@ read_config_file() {
|
||||
fi
|
||||
done < $config_filepath
|
||||
|
||||
# shellcheck disable=SC2296
|
||||
for job in ${(k)jobSteps}; do
|
||||
# If the job doesn't exist in the config file then it should be added in it
|
||||
if [[ -z "${jobEnabled["$job"]}" ]]; then
|
||||
@@ -235,6 +239,7 @@ configure() {
|
||||
typeset -A optionsToJob
|
||||
|
||||
local all_options=()
|
||||
# shellcheck disable=SC2296
|
||||
for job in ${(k)jobSteps}; do
|
||||
local current_option=""
|
||||
if [[ "${jobEnabled["$job"]}" = true ]]; then
|
||||
@@ -287,7 +292,7 @@ gradleJavaClear() {
|
||||
if [ -n "$(ls -d ${GradleJarFiles}/jars-* 2>/dev/null)" ];
|
||||
then
|
||||
echo "${FoundText}"
|
||||
|
||||
|
||||
sizeToClear="$(du -sck ${GradleJarFiles}/jars-* | grep 'total' | cut -f1)"
|
||||
|
||||
getHumanReadableValue readableSize $sizeToClear
|
||||
@@ -306,7 +311,7 @@ deleteOldestInstallFusion360() {
|
||||
echo "Clearing outdated Fusion360 versions"
|
||||
|
||||
local targetDirectory="${HOME}/Library/Application Support/Autodesk/webdeploy/production"
|
||||
|
||||
|
||||
if [[ -d "$targetDirectory" ]]
|
||||
then
|
||||
local linkToFind="$(readlink ${HOME}/Library/Application\ Support/Autodesk/webdeploy/production/Autodesk\ Fusion\ 360.app)"
|
||||
@@ -314,7 +319,7 @@ deleteOldestInstallFusion360() {
|
||||
|
||||
echo "Target Directory is '""$targetDirectory""'"
|
||||
echo "Currently used Fusion360 folder: ${extractedFolderName}"
|
||||
|
||||
|
||||
if [ "$extractedFolderName" = "" ] || [ "$extractedFolderName" = "." ];
|
||||
then
|
||||
echo "${NotFoundColor}Unable to find the right folder${Color_Off}"
|
||||
@@ -330,18 +335,18 @@ deleteOldestInstallFusion360() {
|
||||
getHumanReadableValue readableSize $toDelete
|
||||
|
||||
echo "Deleting folders... ${SizeColor}(${readableSize})${Color_Off}"
|
||||
|
||||
|
||||
# Updating cleared
|
||||
addClearedVal cleared $toDelete
|
||||
|
||||
# Clearing folders w/ progression
|
||||
find "$targetDirectory" -mindepth 1 -maxdepth 1 ! -name "$extractedFolderName" ! -name "Autodesk Fusion 360.app" ! -name ".DS_Store" -exec sh -c 'sudo rm -rv "$0" | pv -l -s $(du -a "$0" | wc -l)> /dev/null' "{}" \;
|
||||
|
||||
|
||||
echo "Done!"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "${ClearableNameColor}Fusion360${Color_Off}'s folder ${NotFoundColor}not found${Color_Off}."
|
||||
echo "${ClearableNameColor}Fusion360${Color_Off}'s folder ${NotFoundColor}not found${Color_Off}."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -356,7 +361,7 @@ clearDocker() {
|
||||
fi
|
||||
docker system prune --all --force
|
||||
else
|
||||
echo "${ClearableNameColor}Docker${Color_Off} was ${NotFoundColor}not found${Color_Off}."
|
||||
echo "${ClearableNameColor}Docker${Color_Off} was ${NotFoundColor}not found${Color_Off}."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -385,6 +390,7 @@ echo "${BarColor}==========================================${Color_Off}"
|
||||
read_config_file
|
||||
|
||||
while true; do
|
||||
# shellcheck disable=SC2168
|
||||
local response
|
||||
|
||||
print -n "Want to configure? (y/N): "
|
||||
|
||||
Reference in New Issue
Block a user