From 5346e4d0e1ad2bef0dcc988b891f39842122ed22 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Mon, 25 May 2026 19:51:16 +1000 Subject: [PATCH] Added support for multiple S3 object keys --- README.md | 40 +++++++++++++++++++-------------------- cmd/wails-release/main.go | 18 +++++++++++------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 2efdd24..7d2f3ff 100644 --- a/README.md +++ b/README.md @@ -41,26 +41,26 @@ jobs: ## Inputs -| Name | Required | Default | Description | -|---|---|---|---| -| `working-directory` | no | `.` | Directory containing `wails.json` | -| `app-name` | no | `wails.json` `name` | Override for the app name in artifact filenames | -| `version` | no | derived | Override; otherwise: matching semver tag → strip `v`, else 7-char short SHA | -| `wails-version` | no | from `go.mod` | Override the Wails CLI version | -| `extra-build-flags` | no | `""` | Additional flags appended to `wails build` (shell-quoted) | -| `developer-id-cert-base64` | **yes** | — | Base64-encoded Developer ID `.p12` | -| `developer-id-cert-password` | **yes** | — | `.p12` password | -| `notarization-method` | no | `auto` | `api-key`, `apple-id`, or `auto` (auto picks whichever group is fully populated) | -| `notarization-api-key-base64` | conditional | — | Base64-encoded App Store Connect `.p8` | -| `notarization-api-key-id` | conditional | — | API key ID | -| `notarization-api-issuer-id` | conditional | — | Issuer ID | -| `notarization-apple-id` | conditional | — | Apple ID (email) | -| `notarization-apple-password` | conditional | — | App-specific password | -| `notarization-team-id` | conditional | — | Developer Team ID | -| `s3-bucket` | no | — | Bucket name. If unset, upload is skipped. | -| `s3-key` | conditional | — | Object key. Required if `s3-bucket` is set. Supports `{version}` and `{filename}` placeholders. | -| `s3-endpoint-url` | no | — | Custom endpoint for S3-compatible storage (MinIO, R2, etc.) | -| `s3-region` | no | `us-east-1` | AWS region | +| Name | Required | Default | Description | +|---|---|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `working-directory` | no | `.` | Directory containing `wails.json` | +| `app-name` | no | `wails.json` `name` | Override for the app name in artifact filenames | +| `version` | no | derived | Override; otherwise: matching semver tag → strip `v`, else 7-char short SHA | +| `wails-version` | no | from `go.mod` | Override the Wails CLI version | +| `extra-build-flags` | no | `""` | Additional flags appended to `wails build` (shell-quoted) | +| `developer-id-cert-base64` | **yes** | — | Base64-encoded Developer ID `.p12` | +| `developer-id-cert-password` | **yes** | — | `.p12` password | +| `notarization-method` | no | `auto` | `api-key`, `apple-id`, or `auto` (auto picks whichever group is fully populated) | +| `notarization-api-key-base64` | conditional | — | Base64-encoded App Store Connect `.p8` | +| `notarization-api-key-id` | conditional | — | API key ID | +| `notarization-api-issuer-id` | conditional | — | Issuer ID | +| `notarization-apple-id` | conditional | — | Apple ID (email) | +| `notarization-apple-password` | conditional | — | App-specific password | +| `notarization-team-id` | conditional | — | Developer Team ID | +| `s3-bucket` | no | — | Bucket name. If unset, upload is skipped. | +| `s3-key` | conditional | — | Object key. Required if `s3-bucket` is set. Supports `{version}` and `{filename}` placeholders. Use commas for multiple uploads. | +| `s3-endpoint-url` | no | — | Custom endpoint for S3-compatible storage (MinIO, R2, etc.) | +| `s3-region` | no | `us-east-1` | AWS region | | `s3-acl` | no | — | Canned ACL applied to the uploaded object (e.g. `public-read`). Empty = no ACL sent. Modern AWS buckets with Object Ownership = "Bucket owner enforced" reject any ACL — leave this unset for those. | AWS credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, optionally `AWS_SESSION_TOKEN`) are read from the standard environment, **not** from action inputs. diff --git a/cmd/wails-release/main.go b/cmd/wails-release/main.go index 425378d..5aafeb3 100644 --- a/cmd/wails-release/main.go +++ b/cmd/wails-release/main.go @@ -10,6 +10,7 @@ import ( "path/filepath" "regexp" "runtime" + "strings" "lmika.dev/actions/wails-release/internal/actions" "lmika.dev/actions/wails-release/internal/archive" @@ -167,14 +168,17 @@ func run(ctx context.Context) error { if err != nil { return err } - key := upload.RenderKey(cfg.S3Key, resolvedVersion, artifactName) - s3URL, err = upload.Upload(ctx, client, upload.Opts{ - Bucket: cfg.S3Bucket, Key: key, FilePath: zipPath, ACL: cfg.S3ACL, - }) - if err != nil { - return err + + for _, keyPart := range strings.Split(cfg.S3Key, ",") { + key := upload.RenderKey(keyPart, resolvedVersion, artifactName) + s3URL, err = upload.Upload(ctx, client, upload.Opts{ + Bucket: cfg.S3Bucket, Key: key, FilePath: zipPath, ACL: cfg.S3ACL, + }) + if err != nil { + return err + } + fmt.Println("Uploaded to:", upload.HTTPSURL(cfg.S3Bucket, key, cfg.S3Region, cfg.S3EndpointURL)) } - fmt.Println("Uploaded to:", upload.HTTPSURL(cfg.S3Bucket, key, cfg.S3Region, cfg.S3EndpointURL)) } // 8. Outputs (fixed order so partial-write failures are reproducible)