Skip to content

Commit 9005990

Browse files
committed
Merge branch 'main' into next
# Conflicts: # .github/workflows/ci.yml # package-lock.json # src/linux-install.ts # src/swift-versions.ts # src/windows-install.ts
2 parents 7d6348b + 7ca6abe commit 9005990

File tree

7 files changed

+59
-19
lines changed

7 files changed

+59
-19
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix:
2929
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
30-
swift: ["6.1"]
30+
swift: ["6.2"]
3131
steps:
3232
- uses: actions/checkout@v4
3333
- name: Setup Node

.github/workflows/stability.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, macos-latest]
14-
swift: ["5.10"]
14+
swift: ["6.2"]
1515
steps:
1616
- uses: swift-actions/setup-swift@v2
1717
with:
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
os: [ubuntu-latest, macos-latest]
28-
swift: ["5.10"]
28+
swift: ["6.2"]
2929
steps:
3030
- uses: swift-actions/setup-swift@main
3131
with:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Ubuntu%20%7C%20Windows-lightgray" alt="Supports macOS, Ubuntu & Windows" />
99
</a>
1010
<a href="https://swift.org">
11-
<img src="https://img.shields.io/badge/Swift-6.0.2-F05138?logo=swift&logoColor=white" alt="Swift 6.1.0" />
11+
<img src="https://img.shields.io/badge/Swift-6.2-F05138?logo=swift&logoColor=white" alt="Swift 6.2" />
1212
</a>
1313
<a href="https://github.com/swift-actions/setup-swift/releases/latest">
1414
<img src="https://img.shields.io/github/v/release/swift-actions/setup-swift?sort=semver" alt="Latest release" />
@@ -20,6 +20,7 @@
2020
> [!IMPORTANT]
2121
> 3.0 is coming, powered by Swiftly 🚀 - follow progress on https://github.com/swift-actions/setup-swift/pull/710
2222
23+
2324
## Usage
2425

2526
To run the action with the latest swift version available, simply add the action as a step in your workflow:
@@ -33,7 +34,7 @@ After the environment is configured you can run swift commands using the standar
3334
```yaml
3435
- uses: swift-actions/setup-swift@v2
3536
- name: Get swift version
36-
run: swift --version # Swift 6.1.0
37+
run: swift --version # Swift 6.2
3738
```
3839

3940
A specific Swift version can be set using the `swift-version` input:

dist/index.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,27 @@ exports.refreshKeys = exports.verify = exports.setupKeys = void 0;
7676
const exec_1 = __nccwpck_require__(1514);
7777
const core = __importStar(__nccwpck_require__(2186));
7878
const toolCache = __importStar(__nccwpck_require__(7784));
79-
async function setupKeys() {
79+
const os_1 = __nccwpck_require__(1855);
80+
async function setupKeys(system) {
8081
core.debug("Fetching verification keys");
8182
let path = await toolCache.downloadTool("https://swift.org/keys/all-keys.asc");
82-
core.debug("Importing verification keys");
83-
await (0, exec_1.exec)(`gpg --import "${path}"`);
83+
if (system.os === os_1.OS.Ubuntu || system.os === os_1.OS.MacOS) {
84+
core.debug("Examining verification keys");
85+
await (0, exec_1.exec)(`file "${path}"`);
86+
const isPlaintext = await (0, exec_1.exec)(`gunzip --test "${path}"`, undefined, {
87+
silent: true,
88+
ignoreReturnCode: true,
89+
});
90+
core.debug("Importing verification keys");
91+
await (0, exec_1.exec)("bash", [
92+
"-c",
93+
`${isPlaintext ? "cat" : "zcat"} "${path}" | gpg --import`,
94+
]);
95+
}
96+
if (system.os === os_1.OS.Windows) {
97+
core.debug("Importing verification keys");
98+
await (0, exec_1.exec)(`gpg --import "${path}"`);
99+
}
84100
core.debug("Refreshing keys");
85101
await refreshKeys();
86102
}
@@ -165,7 +181,7 @@ async function install(version, system) {
165181
let swiftPath = toolCache.find(`swift-${system.name}`, version);
166182
if (swiftPath === null || swiftPath.trim().length == 0) {
167183
core.debug(`No matching installation found`);
168-
await (0, gpg_1.setupKeys)();
184+
await (0, gpg_1.setupKeys)(system);
169185
const swiftPkg = (0, swift_versions_1.swiftPackage)(version, system);
170186
let { pkg, signature } = await download(swiftPkg);
171187
await (0, gpg_1.verify)(signature, pkg);
@@ -460,7 +476,12 @@ const semver = __importStar(__nccwpck_require__(1383));
460476
const core = __importStar(__nccwpck_require__(2186));
461477
const os_1 = __nccwpck_require__(1855);
462478
const VERSIONS_LIST = [
463-
["6.1.0", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
479+
["6.2.1", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
480+
["6.2", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
481+
["6.1.3", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
482+
["6.1.2", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
483+
["6.1.1", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
484+
["6.1", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
464485
["6.0.3", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
465486
["6.0.2", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
466487
["6.0.1", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
@@ -790,7 +811,7 @@ const toolCache = __importStar(__nccwpck_require__(7784));
790811
const path = __importStar(__nccwpck_require__(1017));
791812
const exec_1 = __nccwpck_require__(1514);
792813
const swift_versions_1 = __nccwpck_require__(8263);
793-
const gpg_1 = __nccwpck_require__(9060);
814+
//import { setupKeys, verify } from "./gpg";
794815
const visual_studio_1 = __nccwpck_require__(5219);
795816
async function install(version, system) {
796817
if (os.platform() !== "win32") {
@@ -801,9 +822,9 @@ async function install(version, system) {
801822
let swiftPath = toolCache.find(`swift-${system.name}`, version);
802823
if (swiftPath === null || swiftPath.trim().length == 0) {
803824
core.debug(`No cached installer found`);
804-
await (0, gpg_1.setupKeys)();
825+
//await setupKeys(system);
805826
let { exe, signature } = await download(swiftPkg);
806-
await (0, gpg_1.verify)(signature, exe);
827+
//await verify(signature, exe);
807828
const exePath = await toolCache.cacheFile(exe, swiftPkg.name, `swift-${system.name}`, version);
808829
swiftPath = path.join(exePath, swiftPkg.name);
809830
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-swift",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "Set up GitHub Actions workflow with Swift support",
55
"private": true,
66
"main": "lib/main.js",

src/core/gpg.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
import { exec } from "@actions/exec";
22
import * as core from "@actions/core";
33
import * as toolCache from "@actions/tool-cache";
4+
import { OS, System } from "./os";
45

5-
export async function setupKeys() {
6+
export async function setupKeys(system: System) {
67
core.debug("Fetching verification keys");
78
let path = await toolCache.downloadTool(
89
"https://swift.org/keys/all-keys.asc",
910
);
1011

11-
core.debug("Importing verification keys");
12-
await exec(`gpg --import "${path}"`);
12+
if (system.os === OS.Ubuntu || system.os === OS.MacOS) {
13+
core.debug("Examining verification keys");
14+
await exec(`file "${path}"`);
15+
const isPlaintext = await exec(`gunzip --test "${path}"`, undefined, {
16+
silent: true,
17+
ignoreReturnCode: true,
18+
});
19+
20+
core.debug("Importing verification keys");
21+
await exec("bash", [
22+
"-c",
23+
`${isPlaintext ? "cat" : "zcat"} "${path}" | gpg --import`,
24+
]);
25+
}
26+
27+
if (system.os === OS.Windows) {
28+
core.debug("Importing verification keys");
29+
await exec(`gpg --import "${path}"`);
30+
}
1331

1432
core.debug("Refreshing keys");
1533
await refreshKeys();

0 commit comments

Comments
 (0)