Allow manual Swift 1.1.1 release publishing
Seto Elkahfi committed
May 15, 2026 at 12:08 UTC
afd415ab04cb1a87b36687f37e06d4df34dc078a
1 file changed
+45
-15
.github/workflows/release-sdk-swift.yml
+45
-15
@@ -5,6 +5,15 @@ on:
5
tags:
6
- "[0-9]+.[0-9]+.[0-9]+"
7
workflow_dispatch:
8
+ inputs:
9
+ publish:
10
+ description: "Publish Swift release assets from the selected ref"
11
+ type: boolean
12
+ default: false
13
+ release_tag:
14
+ description: "Existing semver tag to publish on manual runs, for example 1.1.1"
15
+ type: string
16
+ required: false
17
18
permissions:
19
contents: write
@@ -54,14 +63,34 @@ jobs:
63
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
64
echo "checksum=$CHECKSUM" >> "$GITHUB_OUTPUT"
65
57
- - name: Validate tag matches Cargo.toml version
58
- if: startsWith(github.ref, 'refs/tags/')
66
+ - name: Resolve release tag
67
+ id: release
68
+ env:
69
+ INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
70
+ run: |
71
+ if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
72
+ RELEASE_TAG="${GITHUB_REF_NAME}"
73
+ else
74
+ RELEASE_TAG="${INPUT_RELEASE_TAG}"
75
+ fi
76
+
77
+ if [ -n "${RELEASE_TAG}" ]; then
78
+ echo "release_tag=${RELEASE_TAG}" >> "$GITHUB_OUTPUT"
79
+ fi
80
+
81
+ - name: Validate release tag matches Cargo.toml version
82
+ if: startsWith(github.ref, 'refs/tags/') || inputs.publish
83
env:
84
CARGO_VERSION: ${{ steps.meta.outputs.version }}
61
- TAG: ${{ github.ref_name }}
85
+ RELEASE_TAG: ${{ steps.release.outputs.release_tag }}
86
run: |
63
- if [ "$TAG" != "$CARGO_VERSION" ]; then
64
- echo "::error::Tag '$TAG' does not match Cargo.toml version '$CARGO_VERSION'. Update Cargo.toml or re-tag."
87
+ if [ -z "$RELEASE_TAG" ]; then
88
+ echo "::error::release_tag is required when publish=true on workflow_dispatch runs."
89
+ exit 1
90
+ fi
91
+
92
+ if [ "$RELEASE_TAG" != "$CARGO_VERSION" ]; then
93
+ echo "::error::Release tag '$RELEASE_TAG' does not match Cargo.toml version '$CARGO_VERSION'. Update Cargo.toml or publish the matching tag."
94
exit 1
95
fi
96
echo "Version check passed: $CARGO_VERSION"
@@ -81,22 +110,23 @@ jobs:
110
if-no-files-found: error
111
retention-days: 14
112
84
- # ── Create GitHub Release and attach assets (tag push only) ──────────
113
+ # ── Create GitHub Release and attach assets ──────────────────────────
114
115
- name: Create GitHub Release
87
- if: startsWith(github.ref, 'refs/tags/')
116
+ if: startsWith(github.ref, 'refs/tags/') || inputs.publish
117
uses: softprops/action-gh-release@v2
118
with:
90
- name: ${{ github.ref_name }}
119
+ tag_name: ${{ steps.release.outputs.release_tag }}
120
+ name: ${{ steps.release.outputs.release_tag }}
121
generate_release_notes: true
122
files: |
123
dist/swift/OndeFramework.xcframework.zip
124
dist/swift/OndeFramework.checksum.txt
125
96
- # ── Update onde-swift (tag push only) ────────────────────────────────
126
+ # ── Update onde-swift ────────────────────────────────────────────────
127
128
- name: Checkout onde-swift
99
- if: startsWith(github.ref, 'refs/tags/')
129
+ if: startsWith(github.ref, 'refs/tags/') || inputs.publish
130
uses: actions/checkout@v6
131
with:
132
repository: ondeinference/onde-swift
@@ -104,10 +134,10 @@ jobs:
134
path: onde-swift
135
136
- name: Rewrite Package.swift release constants
107
- if: startsWith(github.ref, 'refs/tags/')
137
+ if: startsWith(github.ref, 'refs/tags/') || inputs.publish
138
env:
139
CHECKSUM: ${{ steps.meta.outputs.checksum }}
110
- RELEASE_URL: https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/OndeFramework.xcframework.zip
140
+ RELEASE_URL: https://github.com/${{ github.repository }}/releases/download/${{ steps.release.outputs.release_tag }}/OndeFramework.xcframework.zip
141
run: |
142
python3 - <<'PY'
143
import os, re, pathlib
@@ -141,15 +171,15 @@ jobs:
171
PY
172
173
- name: Copy generated onde.swift into onde-swift
144
- if: startsWith(github.ref, 'refs/tags/')
174
+ if: startsWith(github.ref, 'refs/tags/') || inputs.publish
175
run: |
176
cp dist/swift/Package/Sources/Onde/onde.swift \
177
onde-swift/Sources/Onde/onde.swift
178
179
- name: Commit and tag onde-swift
150
- if: startsWith(github.ref, 'refs/tags/')
180
+ if: startsWith(github.ref, 'refs/tags/') || inputs.publish
181
env:
152
- VERSION: ${{ steps.meta.outputs.version }}
182
+ VERSION: ${{ steps.release.outputs.release_tag }}
183
run: |
184
cd onde-swift
185
git config user.name "github-actions[bot]"