You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A reusable GitHub Action that generates standardized container image tags from a Git ref, with optional prefix and fork-repo prepending. Centralizes the tag-derivation logic that was previously duplicated across `bitwarden/server`, `bitwarden/clients`, and `bitwarden/self-host`.
| `ref` | Branch or tag reference. Accepts both `refs/heads/<name>` / `refs/tags/<name>` form and bare branch names. | Yes | |
47
+
| `prefix` | Prepended verbatim to the final tag (include trailing dash, e.g., `server-`). | No | `""` |
48
+
| `fork_repo` | Sanitized fork repo full name (e.g., `forkuser/repo`) prepended to distinguish fork-PR builds. Empty for non-fork events. | No | `""` |
49
+
50
+
## Outputs
51
+
52
+
| Output | Description |
53
+
| ------ | --------------------------------- |
54
+
| `tag` | The generated container image tag |
55
+
56
+
## Tag generation rules
57
+
58
+
1. **Ref extraction**: strips `refs/heads/` or `refs/tags/` prefix if present.
59
+
2. **Sanitization**:
60
+
- Lowercases the entire string.
61
+
- Strips a single leading `v` (so `v1.2.3` → `1.2.3`).
62
+
- Replaces any run of characters outside `[a-z0-9._-]` with a single `-`.
63
+
- Collapses repeated dashes.
64
+
- Strips leading/trailing `.` or `-`.
65
+
3. **Fork prepending** (if `fork_repo` is set): sanitized fork name + `-` is prepended.
66
+
4. **Main-to-dev mapping**: a final value of exactly `main` becomes `dev`. Runs after fork prepending so `fork-main` is unaffected.
67
+
5. **Prefix**: `prefix`is prepended verbatim.
68
+
6. **Length cap**: truncated to 128 characters; trailing `.` or `-` after truncation is stripped.
0 commit comments