Skip to content

Commit

Permalink
extracting downloaded encoder correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloChianfa committed Sep 4, 2024
1 parent 5393ace commit a23239a
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
uses: actions/checkout@v2

- name: IonCube Encode
uses: MuriloChianfa/ioncube-encoder-action@v1.1.0
uses: MuriloChianfa/ioncube-encoder-action@v1.0.0
# If you're dont using trial version you need to setup the ioncube download url
# env:
# IONCUBE_DOWNLOAD_URL: ${{ secrets.IONCUBE_DOWNLOAD_URL }}
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
uses: actions/checkout@v2

- name: IonCube Encode Project
uses: MuriloChianfa/ioncube-encoder-action@v1.1.0
uses: MuriloChianfa/ioncube-encoder-action@v1.0.0
# If you're dont using trial version you need to setup the ioncube download url
# env:
# IONCUBE_DOWNLOAD_URL: ${{ secrets.IONCUBE_DOWNLOAD_URL }}
Expand All @@ -95,7 +95,7 @@ jobs:
callback-file: /opt/project/public/ioncube.php

- name: IonCube Encode Callback File
uses: MuriloChianfa/ioncube-encoder-action@v1.1.0
uses: MuriloChianfa/ioncube-encoder-action@v1.0.0
# If you're dont using trial version you need to setup the ioncube download url
# env:
# IONCUBE_DOWNLOAD_URL: ${{ secrets.IONCUBE_DOWNLOAD_URL }}
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 30 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ioncube-encoder-action",
"description": "Github action to automate IonCube encoding for your PHP project.",
"version": "1.1.0",
"version": "1.0.0",
"author": "MuriloChianfa <murilo.chianfa@outlook.com>",
"private": true,
"homepage": "https://github.com/MuriloChianfa/ioncube-encoder-action",
Expand Down
31 changes: 30 additions & 1 deletion src/evaluation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const core = require('@actions/core')
const exec = require('@actions/exec')
const EVALUATION_PATH = './ioncube_encoder_evaluation/ioncube_encoder.sh'
const ENCODER_PATH = './ioncube_encoder/ioncube_encoder.sh'
const IONCUBE_EVAL_URL = 'https://www.ioncube.com/eval_linux'
Expand Down Expand Up @@ -48,7 +49,35 @@ module.exports = async function encoder() {

if (!fs.existsSync(ioncube_folder)) {
await download(downloadUrl, gzip_encoder_path)
await tar.extract({ file: gzip_encoder_path })

if (!fs.existsSync(ioncube_folder)) {
fs.mkdirSync(ioncube_folder, { recursive: true })
}

if (!fs.existsSync(ioncube_folder)) {
fs.mkdirSync(ioncube_folder, { recursive: true })
}

let myOutput = ''
let myError = ''

const options = {}
options.listeners = {
stdout: data => {
myOutput += data.toString()
},
stderr: data => {
myError += data.toString()
}
}
options.silent = false
options.failOnStdErr = false
options.ignoreReturnCode = false
await exec.exec(
`tar -xzvf ioncube_encoder.tar.gz -C ${ioncube_folder} --strip-components=1`,
[],
options
)

if (fs.existsSync(gzip_encoder_path)) {
fs.unlinkSync(gzip_encoder_path)
Expand Down

0 comments on commit a23239a

Please sign in to comment.