diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/.github/actions/generate-action-code/action.yml b/.github/actions/generate-action-code/action.yml index 00b10bd..7f44878 100644 --- a/.github/actions/generate-action-code/action.yml +++ b/.github/actions/generate-action-code/action.yml @@ -6,7 +6,7 @@ runs: steps: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 check-latest: true cache: 'npm' - name: Generate action code diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6cf41fb..554ee73 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,11 +2,11 @@ name: CodeQL on: push: - branches: [ master ] + branches: [ main ] paths-ignore: [ 'dist/*.js' ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ main ] schedule: - cron: '15 11 * * 1' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3a9d59a..9ae360e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Deploy Action Code on: push: - branches: [ master ] + branches: [ main ] paths-ignore: [ 'dist/*.js' ] jobs: diff --git a/.github/workflows/tag-update.yml b/.github/workflows/tag-update.yml index 541b5c3..49d757a 100644 --- a/.github/workflows/tag-update.yml +++ b/.github/workflows/tag-update.yml @@ -8,10 +8,10 @@ jobs: update-tags: name: Update Running Releases runs-on: ubuntu-latest + if: ${{ github.event.release.prerelease == false }} steps: - uses: actions/checkout@v4 - - uses: sersoft-gmbh/running-release-tags-action@v2 - if: ${{ github.event.release.prerelease == false }} + - uses: sersoft-gmbh/running-release-tags-action@v3 with: update-full-release: true github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 57913db..ec29a85 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,13 +2,13 @@ name: Tests on: push: - branches: [ master ] + branches: [ main ] paths: - 'dist/*.js' - '.github/actions/generate-action-code/**' - '.github/workflows/tests.yml' pull_request: - branches: [ master ] + branches: [ main ] jobs: test-spm: @@ -29,7 +29,7 @@ jobs: - name: Generate action code if: ${{ github.event_name == 'pull_request' }} uses: ./.github/actions/generate-action-code - - uses: sersoft-gmbh/swifty-docs-action@master + - uses: sersoft-gmbh/swifty-docs-action@main if: ${{ github.event_name == 'push' }} with: package-path: ${{ env.INPUT_PACKAGE_PATH }} @@ -67,7 +67,7 @@ jobs: - name: Generate action code if: ${{ github.event_name == 'pull_request' }} uses: ./.github/actions/generate-action-code - - uses: sersoft-gmbh/swifty-docs-action@master + - uses: sersoft-gmbh/swifty-docs-action@main if: ${{ github.event_name == 'push' }} with: package-path: ${{ env.INPUT_PACKAGE_PATH }} diff --git a/README.md b/README.md index 64e6f7d..004b464 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This action generates documentation for a Swift package using `docc`. **Important:** The package must use the [Swift-DocC Plugin](https://github.com/apple/swift-docc-plugin) unless `xcodebuild` is used! -**Note:** Version 2 of this action replaced `jazzy` with `docc`! Use `@v1` to use `jazzy`. +**Note:** As of version 2, this action uses `docc` instead of `jazzy`! Use `@v1` to use `jazzy`. ## Inputs @@ -73,7 +73,7 @@ The path to the output directory. Use the following snippet in a Swift package repository to generate documentation for all products of your Swift package: ```yaml -uses: sersoft-gmbh/swifty-docs-action@v2 +uses: sersoft-gmbh/swifty-docs-action@v3 with: output: docs ``` diff --git a/action.yml b/action.yml index 27d3769..66b1cfe 100644 --- a/action.yml +++ b/action.yml @@ -47,7 +47,7 @@ inputs: description: The path to the output folder. required: false runs: - using: node16 + using: node20 main: dist/index.js branding: color: orange diff --git a/dist/index.js b/dist/index.js index 422b9ab..c0b351f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -34,10 +34,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); const core = __importStar(__nccwpck_require__(186)); -const exec = __importStar(__nccwpck_require__(514)); +const exec_1 = __nccwpck_require__(514); const path_1 = __importDefault(__nccwpck_require__(17)); async function runCmd(cmd, args, cwd) { - const output = await exec.getExecOutput(cmd, args, { + const output = await (0, exec_1.getExecOutput)(cmd, args, { cwd: cwd, silent: !core.isDebug(), }); @@ -73,9 +73,8 @@ async function generateDocsUsingSPM(packagePath, targets, options) { if (options.outputPath) args.push('--allow-writing-to-directory', options.outputPath); args.push('generate-documentation'); - if (targets.length > 0) { + if (targets.length > 0) args.push(...targets.flatMap(t => ['--target', t])); - } args.push(...docCFlags(options, true)); return await runCmd('swift', args, packagePath); } diff --git a/dist/license.txt b/dist/license.txt new file mode 100644 index 0000000..d771846 --- /dev/null +++ b/dist/license.txt @@ -0,0 +1,97 @@ +@actions/core +MIT +The MIT License (MIT) + +Copyright 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +@actions/exec +MIT +The MIT License (MIT) + +Copyright 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +@actions/http-client +MIT +Actions Http Client for Node.js + +Copyright (c) GitHub, Inc. + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +@actions/io +MIT +The MIT License (MIT) + +Copyright 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +tunnel +MIT +The MIT License (MIT) + +Copyright (c) 2012 Koichi Kobayashi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +uuid +MIT +The MIT License (MIT) + +Copyright (c) 2010-2020 Robert Kieffer and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package-lock.json b/package-lock.json index abb853e..0abc5d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,25 @@ { "name": "swifty-docs-action", - "version": "2.0.0", + "version": "3.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "swifty-docs-action", - "version": "2.0.0", + "version": "3.0.0", "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1" }, "devDependencies": { - "@types/node": "^16.18.50", + "@tsconfig/node20": "^20.1.2", + "@types/node": "^20.6.2", "@vercel/ncc": "^0.38.0", "typescript": "^5.2.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@actions/core": { @@ -48,10 +52,16 @@ "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" }, + "node_modules/@tsconfig/node20": { + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.2.tgz", + "integrity": "sha512-madaWq2k+LYMEhmcp0fs+OGaLFk0OenpHa4gmI4VEmCKX4PJntQ6fnnGADVFrVkBj0wIdAlQnK/MrlYTHsa1gQ==", + "dev": true + }, "node_modules/@types/node": { - "version": "16.18.50", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.50.tgz", - "integrity": "sha512-OiDU5xRgYTJ203v4cprTs0RwOCd5c5Zjv+K5P8KSqfiCsB1W3LcamTUMcnQarpq5kOYbhHfSOgIEJvdPyb5xyw==", + "version": "20.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz", + "integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==", "dev": true }, "node_modules/@vercel/ncc": { diff --git a/package.json b/package.json index fa87715..7b7abcb 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { "name": "swifty-docs-action", - "version": "2.0.0", + "version": "3.0.0", "description": "A GitHub action generates the documentation for all products of a Swift package using docc.", - "main": "dist/index.js", + "engines": { + "node": ">=20" + }, + "exports": { + ".": "./dist/index.js" + }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "tsc", - "pack": "rm -rf dist && ncc build lib/main.js -o dist" + "pack": "rm -rf dist && ncc build lib/main.js -o dist --license license.txt --target es2022" }, "repository": { "type": "git", @@ -27,7 +32,8 @@ "@actions/exec": "^1.1.1" }, "devDependencies": { - "@types/node": "^16.18.50", + "@tsconfig/node20": "^20.1.2", + "@types/node": "^20.6.2", "@vercel/ncc": "^0.38.0", "typescript": "^5.2.2" } diff --git a/src/main.ts b/src/main.ts index c22eba2..6204adf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ import * as core from '@actions/core'; -import * as exec from '@actions/exec'; +import { getExecOutput } from '@actions/exec'; import path from 'path'; interface ILengthProviding { @@ -17,7 +17,7 @@ interface IDocCOptions { } async function runCmd(cmd: string, args?: string[], cwd?: string): Promise { - const output = await exec.getExecOutput(cmd, args, { + const output = await getExecOutput(cmd, args, { cwd: cwd, silent: !core.isDebug(), }); @@ -49,9 +49,7 @@ async function generateDocsUsingSPM(packagePath: string, targets: string[], opti let args = ['package']; if (options.outputPath) args.push('--allow-writing-to-directory', options.outputPath); args.push('generate-documentation'); - if (targets.length > 0) { - args.push(...targets.flatMap(t => ['--target', t])); - } + if (targets.length > 0) args.push(...targets.flatMap(t => ['--target', t])); args.push(...docCFlags(options, true)); return await runCmd('swift', args, packagePath); } diff --git a/tsconfig.json b/tsconfig.json index fb4b0bd..50a43e1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,8 @@ { + "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { - "target": "ES2019", - "module": "commonjs", - "outDir": "./lib", - "rootDir": "./src", - "strict": true, - "esModuleInterop": true + "outDir": "lib", + "rootDir": "src" }, "include": ["src/**/*"] }