Skip to content

Commit ffd429c

Browse files
committed
test
1 parent 02aa227 commit ffd429c

File tree

1 file changed

+40
-59
lines changed

1 file changed

+40
-59
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -61,75 +61,56 @@ jobs:
6161
with:
6262
repository: skidfuscatordev/homebrew-skidfuscator
6363
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
64-
# Use a branch name where the formula resides, usually 'main'
6564
ref: master
6665
- name: List Files
6766
run: ls -R
68-
- name: Create Formula if Missing
67+
- name: Cleanup and Prepare Formula
6968
run: |
69+
# Remove any existing formula files
70+
rm -f ./Formula/skidfuscator*.rb
71+
72+
# Create the new formula file
7073
FORMULA_PATH="Formula/skidfuscator.rb"
71-
mkdir -p "$(dirname $FORMULA_PATH)"
72-
if [[ ! -f "$FORMULA_PATH" ]]; then
73-
echo "Creating formula file..."
74-
cat <<EOF > "$FORMULA_PATH"
74+
cat <<EOF > "$FORMULA_PATH"
7575
class Skidfuscator < Formula
76-
desc "A JVM-based obfuscation suite designed for Java and Android bytecode"
77-
homepage "https://github.com/skidfuscatordev/skidfuscator-java-obfuscator"
78-
url "PLACEHOLDER"
79-
sha256 "PLACEHOLDER"
80-
version "PLACEHOLDER"
81-
license "MIT"
82-
83-
def install
84-
libexec.install Dir["*.jar"]
85-
jar_name = Dir["#{libexec}/*.jar"].first
86-
(bin/"skidfuscator").write <<~EOS
87-
#!/usr/bin/env bash
88-
exec java -jar "#{jar_name}" "$@"
89-
EOS
90-
(bin/"skidfuscator").chmod 0755
91-
end
92-
93-
test do
94-
output = shell_output("#{bin}/skidfuscator --help", 0)
95-
assert_match "Usage", output
96-
end
76+
desc "A JVM-based obfuscation suite designed for Java and Android bytecode"
77+
homepage "https://github.com/skidfuscatordev/skidfuscator-java-obfuscator"
78+
url "${{ steps.find_asset.outputs.asset_url }}"
79+
sha256 "${{ steps.sha256.outputs.sha256 }}"
80+
version "${{ steps.extract_version.outputs.version }}"
81+
license "MIT"
82+
83+
def install
84+
libexec.install Dir["*.jar"]
85+
jar_name = Dir["#{libexec}/*.jar"].first
86+
(bin/"skidfuscator").write <<~EOS
87+
#!/usr/bin/env bash
88+
exec java -jar "#{jar_name}" "\$@"
89+
EOS
90+
(bin/"skidfuscator").chmod 0755
91+
end
92+
93+
test do
94+
output = shell_output("#{bin}/skidfuscator --help", 0)
95+
assert_match "Usage", output
96+
end
9797
end
9898
EOF
99-
fi
100-
- name: Show Formula Contents
101-
run: cat ./Formula/skidfuscator.rb
102-
- name: Update formula
99+
100+
- name: Debug Formula Content
103101
run: |
104-
FORMULA_PATH="./Formula/skidfuscator.rb"
105-
NEW_VERSION="${{ steps.extract_version.outputs.version }}"
106-
NEW_URL="${{ steps.find_asset.outputs.asset_url }}"
107-
NEW_SHA256="${{ steps.sha256.outputs.sha256 }}"
108-
109-
# Update url line
110-
sed -i.bak "s|^ url \".*\"| url \"${NEW_URL}\"|" $FORMULA_PATH
111-
# Update sha256 line
112-
sed -i.bak "s|^ sha256 \".*\"| sha256 \"${NEW_SHA256}\"|" $FORMULA_PATH
113-
# Update version line
114-
sed -i.bak "s|^ version \".*\"| version \"${NEW_VERSION}\"|" $FORMULA_PATH
115-
116-
# Clean backup
117-
rm $FORMULA_PATH.bak
118-
119-
echo "Updated formula with version=${NEW_VERSION}, url=${NEW_URL}, sha256=${NEW_SHA256}"
120-
cat $FORMULA_PATH
121-
- name: Show updated formula
122-
run: cat ./Formula/skidfuscator.rb
102+
echo "Formula content:"
103+
cat "$FORMULA_PATH"
104+
echo "Git status:"
105+
git status
106+
123107
- name: Commit and push changes
124108
run: |
125-
if [[ -n "$(git status --porcelain)" ]]; then
126-
git config user.name "github-actions"
127-
git config user.email "[email protected]"
128-
git add ./Formula/skidfuscator.rb
129-
git commit -m "Update Skidfuscator formula to version ${{ steps.extract_version.outputs.version }}"
130-
git push origin HEAD:master
131-
else
132-
echo "No changes to commit"
133-
fi
109+
git config user.name "github-actions"
110+
git config user.email "[email protected]"
111+
git add ./Formula/skidfuscator.rb
112+
git commit -m "Update Skidfuscator formula to version ${{ steps.extract_version.outputs.version }}"
113+
git push origin HEAD:master
134114
env:
135115
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
116+

0 commit comments

Comments
 (0)