Added support for multiple S3 object keys

This commit is contained in:
Leon Mika 2026-05-25 19:51:16 +10:00
parent 8f346b53fa
commit 5346e4d0e1
2 changed files with 31 additions and 27 deletions

View file

@ -42,7 +42,7 @@ jobs:
## Inputs ## Inputs
| Name | Required | Default | Description | | Name | Required | Default | Description |
|---|---|---|---| |---|---|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `working-directory` | no | `.` | Directory containing `wails.json` | | `working-directory` | no | `.` | Directory containing `wails.json` |
| `app-name` | no | `wails.json` `name` | Override for the app name in artifact filenames | | `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 | | `version` | no | derived | Override; otherwise: matching semver tag → strip `v`, else 7-char short SHA |
@ -58,7 +58,7 @@ jobs:
| `notarization-apple-password` | conditional | — | App-specific password | | `notarization-apple-password` | conditional | — | App-specific password |
| `notarization-team-id` | conditional | — | Developer Team ID | | `notarization-team-id` | conditional | — | Developer Team ID |
| `s3-bucket` | no | — | Bucket name. If unset, upload is skipped. | | `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-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-endpoint-url` | no | — | Custom endpoint for S3-compatible storage (MinIO, R2, etc.) |
| `s3-region` | no | `us-east-1` | AWS region | | `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. | | `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. |

View file

@ -10,6 +10,7 @@ import (
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime" "runtime"
"strings"
"lmika.dev/actions/wails-release/internal/actions" "lmika.dev/actions/wails-release/internal/actions"
"lmika.dev/actions/wails-release/internal/archive" "lmika.dev/actions/wails-release/internal/archive"
@ -167,7 +168,9 @@ func run(ctx context.Context) error {
if err != nil { if err != nil {
return err return err
} }
key := upload.RenderKey(cfg.S3Key, resolvedVersion, artifactName)
for _, keyPart := range strings.Split(cfg.S3Key, ",") {
key := upload.RenderKey(keyPart, resolvedVersion, artifactName)
s3URL, err = upload.Upload(ctx, client, upload.Opts{ s3URL, err = upload.Upload(ctx, client, upload.Opts{
Bucket: cfg.S3Bucket, Key: key, FilePath: zipPath, ACL: cfg.S3ACL, Bucket: cfg.S3Bucket, Key: key, FilePath: zipPath, ACL: cfg.S3ACL,
}) })
@ -176,6 +179,7 @@ func run(ctx context.Context) error {
} }
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) // 8. Outputs (fixed order so partial-write failures are reproducible)
outFile := os.Getenv("GITHUB_OUTPUT") outFile := os.Getenv("GITHUB_OUTPUT")