Skip to content

Commit

Permalink
Use node20, update tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Sep 17, 2023
1 parent a810639 commit aa2da0a
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 31 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/actions/generate-action-code/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tag-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ _None_

### `version`

The version of Swift that's currently active (e.g. `5.4.2`).
The version of Swift that's currently active (e.g. `5.8.1`).

## Example Usage

Use the following snippet to read the current swift version:
```yaml
uses: sersoft-gmbh/swift-version-action@v2
uses: sersoft-gmbh/swift-version-action@v3
```
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ description: Reads the current Swift version
author: ser.soft GmbH
outputs:
version:
description: The current Swift version (e.g. `5.4.2`).
description: The current Swift version (e.g. `5.8.1`).
runs:
using: node16
using: node20
main: dist/index.js
branding:
color: orange
Expand Down
7 changes: 3 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(186));
const exec_1 = __nccwpck_require__(514);
const os_1 = __nccwpck_require__(37);
async function runCmd(cmd, args) {
const output = await (0, exec_1.getExecOutput)(cmd, args, {
failOnStdErr: false,
async function runCmd(cmd, ...args) {
const output = await (0, exec_1.getExecOutput)(cmd, args.length <= 0 ? undefined : args, {
silent: !core.isDebug(),
});
return output.stdout;
}
async function main() {
const swiftVersionOutput = await runCmd('swift', ['--version']);
const swiftVersionOutput = await runCmd('swift', '--version');
const lines = swiftVersionOutput.trim().split(os_1.EOL);
if (lines.length < 1) {
throw new Error('Invalid output from `swift --version`: ' + swiftVersionOutput);
Expand Down
97 changes: 97 additions & 0 deletions dist/license.txt
Original file line number Diff line number Diff line change
@@ -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.
22 changes: 16 additions & 6 deletions package-lock.json

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

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"name": "swift-version-action",
"version": "2.0.0",
"version": "3.0.0",
"description": "A GitHub action that reads the current Swift version.",
"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",
Expand All @@ -26,7 +31,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"
}
Expand Down
7 changes: 3 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import * as core from '@actions/core';
import { getExecOutput } from '@actions/exec';
import { EOL } from 'os';

async function runCmd(cmd: string, args?: string[]): Promise<string> {
const output = await getExecOutput(cmd, args, {
failOnStdErr: false,
async function runCmd(cmd: string, ...args: string[]): Promise<string> {
const output = await getExecOutput(cmd, args.length <= 0 ? undefined : args, {
silent: !core.isDebug(),
});
return output.stdout;
}

async function main() {
const swiftVersionOutput = await runCmd('swift', ['--version']);
const swiftVersionOutput = await runCmd('swift', '--version');
const lines = swiftVersionOutput.trim().split(EOL);
if (lines.length < 1) {
throw new Error('Invalid output from `swift --version`: ' + swiftVersionOutput);
Expand Down
9 changes: 3 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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/**/*"]
}

0 comments on commit aa2da0a

Please sign in to comment.