diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml new file mode 100644 index 0000000..b881cf8 --- /dev/null +++ b/.github/workflows/build-test-release.yml @@ -0,0 +1,100 @@ +name: Build, Test and Release + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + # Allow manual trigger + workflow_dispatch: + +jobs: + detect-changes: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + + - name: Get changed directories + id: set-matrix + run: | + DIRS=$(ls -d */ | grep -v 'node_modules\|.git\|.github' | sed 's/\///g' | jq -R -s -c 'split("\n")[:-1]') + echo "matrix=${DIRS}" >> $GITHUB_OUTPUT + + build-and-test: + needs: detect-changes + runs-on: ubuntu-latest + strategy: + matrix: + action: ${{fromJson(needs.detect-changes.outputs.matrix)}} + fail-fast: false # Continue with other actions even if one fails + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + cache: 'npm' + + - name: Install root dependencies + run: npm ci + + - name: Install action dependencies + working-directory: ${{ matrix.action }} + run: npm ci + + - name: Build + working-directory: ${{ matrix.action }} + run: npm run build + + - name: Test + working-directory: ${{ matrix.action }} + run: | + if [ -f "package.json" ] && grep -q "\"test\"" "package.json"; then + npm test + fi + + release: + needs: build-and-test + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Install dependencies + run: npm ci + + - name: Get version + id: get_version + run: | + VERSION=$(node -p "require('./package.json').version") + echo "version=${VERSION}" >> $GITHUB_OUTPUT + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.get_version.outputs.version }} + release_name: Release v${{ steps.get_version.outputs.version }} + body: | + Release of version ${{ steps.get_version.outputs.version }} + + This release includes all actions in the repository: + - run-discovery + - run-scan + - stop-discovery + - stop-scan + - wait-for + draft: false + prerelease: false diff --git a/package-lock.json b/package-lock.json index 54f74b9..4f3e38b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1370,6 +1370,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -1387,12 +1393,14 @@ } }, "node_modules/axios": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.22.0.tgz", - "integrity": "sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", "license": "MIT", "dependencies": { - "follow-redirects": "^1.14.4" + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/axios-retry": { @@ -1641,6 +1649,18 @@ "dev": true, "license": "MIT" }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -1902,6 +1922,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", @@ -2758,6 +2787,20 @@ "is-callable": "^1.1.3" } }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4171,6 +4214,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", @@ -4588,6 +4652,12 @@ "node": ">=6.0.0" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -4808,7 +4878,7 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/run-discover": { + "node_modules/run-discovery": { "resolved": "run-discovery", "link": true }, @@ -5879,7 +5949,6 @@ } }, "run-discovery": { - "name": "run-discover", "version": "0.1.0", "license": "MIT", "dependencies": { @@ -6165,7 +6234,7 @@ "dependencies": { "@actions/core": "^1.9.1", "@actions/github": "^5.0.0", - "axios": "^0.22.0", + "axios": "^1.7.9", "axios-retry": "^3.2.0" }, "devDependencies": { diff --git a/run-scan/action.yml b/run-scan/action.yml index c20b6e8..f4cedb8 100644 --- a/run-scan/action.yml +++ b/run-scan/action.yml @@ -51,5 +51,5 @@ outputs: id: description: 'Scan ID' runs: - using: 'node12' + using: 'node16' main: 'dist/index.js' diff --git a/stop-scan/action.yml b/stop-scan/action.yml index acdd517..50646d4 100644 --- a/stop-scan/action.yml +++ b/stop-scan/action.yml @@ -14,5 +14,5 @@ inputs: description: 'Hostname. Default is app.brightsec.com' required: false runs: - using: 'node12' + using: 'node16' main: 'dist/index.js' diff --git a/wait-for/action.yml b/wait-for/action.yml index 182c334..d784b7c 100644 --- a/wait-for/action.yml +++ b/wait-for/action.yml @@ -45,5 +45,5 @@ outputs: url: description: 'Url of the resulting scan' runs: - using: 'node12' + using: 'node16' main: 'dist/index.js' diff --git a/wait-for/package.json b/wait-for/package.json index 1dc6df2..6a227b2 100644 --- a/wait-for/package.json +++ b/wait-for/package.json @@ -22,7 +22,7 @@ "dependencies": { "@actions/core": "^1.9.1", "@actions/github": "^5.0.0", - "axios": "^0.22.0", + "axios": "^1.7.9", "axios-retry": "^3.2.0" }, "devDependencies": {