Skip to content

Commit 1976f76

Browse files
committed
fix: export FORMULA_DIR for bottle build and drop x86_64 bottle
macOS x86_64 runners (macos-13) are deprecated. FORMULA_DIR needs export so python3 subprocess can read it.
1 parent a041d2d commit 1976f76

File tree

1 file changed

+5
-99
lines changed

1 file changed

+5
-99
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
TARBALL_SHA: ${{ needs.source-tarball.outputs.tarball_sha256 }}
7474
TAG: ${{ github.ref_name }}
7575
run: |
76-
FORMULA_DIR="$(brew --repo)/Library/Taps/mavlink/homebrew-tap/Formula"
76+
export FORMULA_DIR="$(brew --repo)/Library/Taps/mavlink/homebrew-tap/Formula"
7777
mkdir -p "$FORMULA_DIR"
7878
python3 -c "
7979
import os
@@ -103,96 +103,7 @@ jobs:
103103
)
104104
with open(os.environ['FORMULA_DIR'] + '/mavsim-viewer.rb', 'w') as f:
105105
f.write(formula)
106-
" FORMULA_DIR="$FORMULA_DIR"
107-
108-
- name: Build bottle
109-
run: brew install --build-bottle mavlink/tap/mavsim-viewer
110-
111-
- name: Package bottle
112-
id: bottle
113-
run: |
114-
TAG=${{ github.ref_name }}
115-
brew bottle \
116-
--json \
117-
--root-url="https://github.com/mavlink/mavsim-viewer/releases/download/${TAG}" \
118-
mavlink/tap/mavsim-viewer
119-
120-
BOTTLE_JSON=$(ls mavsim-viewer--*.bottle.json)
121-
BOTTLE_FILE=$(ls mavsim-viewer--*.bottle.tar.gz)
122-
CLEAN_NAME=$(echo "$BOTTLE_FILE" | sed 's/--/-/')
123-
mv "$BOTTLE_FILE" "$CLEAN_NAME"
124-
125-
BOTTLE_SHA=$(python3 -c "
126-
import json, sys
127-
data = json.load(open(sys.argv[1]))
128-
tags = data['mavsim-viewer']['bottle']['tags']
129-
tag = list(tags.keys())[0]
130-
print(tags[tag]['sha256'])
131-
" "$BOTTLE_JSON")
132-
133-
BOTTLE_TAG=$(python3 -c "
134-
import json, sys
135-
data = json.load(open(sys.argv[1]))
136-
tags = data['mavsim-viewer']['bottle']['tags']
137-
print(list(tags.keys())[0])
138-
" "$BOTTLE_JSON")
139-
140-
echo "sha256=${BOTTLE_SHA}" >> "$GITHUB_OUTPUT"
141-
echo "tag=${BOTTLE_TAG}" >> "$GITHUB_OUTPUT"
142-
echo "file=${CLEAN_NAME}" >> "$GITHUB_OUTPUT"
143-
144-
- name: Upload bottle to release
145-
run: gh release upload ${{ github.ref_name }} ${{ steps.bottle.outputs.file }}
146-
env:
147-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148-
149-
# ── Job 2b: macOS x86_64 bottle ───────────────────────────────────────────
150-
bottle-x86_64:
151-
name: Bottle (x86_64)
152-
needs: source-tarball
153-
runs-on: macos-13
154-
outputs:
155-
bottle_sha256: ${{ steps.bottle.outputs.sha256 }}
156-
bottle_tag: ${{ steps.bottle.outputs.tag }}
157-
158-
steps:
159-
- name: Set up tap with formula
160-
env:
161-
VERSION: ${{ needs.source-tarball.outputs.version }}
162-
TARBALL_SHA: ${{ needs.source-tarball.outputs.tarball_sha256 }}
163-
TAG: ${{ github.ref_name }}
164-
run: |
165-
FORMULA_DIR="$(brew --repo)/Library/Taps/mavlink/homebrew-tap/Formula"
166-
mkdir -p "$FORMULA_DIR"
167-
python3 -c "
168-
import os
169-
formula = '''class MavsimViewer < Formula
170-
desc \"3D MAVLink vehicle viewer for SITL simulation\"
171-
homepage \"https://github.com/mavlink/mavsim-viewer\"
172-
url \"https://github.com/mavlink/mavsim-viewer/releases/download/{tag}/mavsim-viewer-{version}.tar.gz\"
173-
sha256 \"{sha}\"
174-
license \"BSD-3-Clause\"
175-
176-
depends_on \"cmake\" => :build
177-
178-
def install
179-
system \"cmake\", \"-S\", \".\", \"-B\", \"build\", \"-DCMAKE_BUILD_TYPE=Release\", *std_cmake_args
180-
system \"cmake\", \"--build\", \"build\"
181-
system \"cmake\", \"--install\", \"build\", \"--prefix\", prefix
182-
end
183-
184-
test do
185-
assert_predicate bin/\"mavsim-viewer\", :executable?
186-
end
187-
end
188-
'''.format(
189-
tag=os.environ['TAG'],
190-
version=os.environ['VERSION'],
191-
sha=os.environ['TARBALL_SHA'],
192-
)
193-
with open(os.environ['FORMULA_DIR'] + '/mavsim-viewer.rb', 'w') as f:
194-
f.write(formula)
195-
" FORMULA_DIR="$FORMULA_DIR"
106+
"
196107
197108
- name: Build bottle
198109
run: brew install --build-bottle mavlink/tap/mavsim-viewer
@@ -235,7 +146,7 @@ jobs:
235146
env:
236147
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
237148

238-
# ── Job 2c: Linux amd64 .deb ──────────────────────────────────────────────
149+
# ── Job 2b: Linux amd64 .deb ──────────────────────────────────────────────
239150
deb-amd64:
240151
name: Deb (amd64)
241152
needs: source-tarball
@@ -281,7 +192,7 @@ jobs:
281192
# ── Job 3: Publish the release ─────────────────────────────────────────────
282193
publish-release:
283194
name: Publish release
284-
needs: [bottle-arm64, bottle-x86_64, deb-amd64]
195+
needs: [bottle-arm64, deb-amd64]
285196
runs-on: ubuntu-latest
286197

287198
steps:
@@ -296,7 +207,7 @@ jobs:
296207
# ── Job 4: Update Homebrew tap ─────────────────────────────────────────────
297208
update-tap:
298209
name: Update Homebrew tap
299-
needs: [source-tarball, bottle-arm64, bottle-x86_64, publish-release]
210+
needs: [source-tarball, bottle-arm64, publish-release]
300211
runs-on: ubuntu-latest
301212

302213
steps:
@@ -307,8 +218,6 @@ jobs:
307218
TARBALL_SHA: ${{ needs.source-tarball.outputs.tarball_sha256 }}
308219
ARM64_SHA: ${{ needs.bottle-arm64.outputs.bottle_sha256 }}
309220
ARM64_TAG: ${{ needs.bottle-arm64.outputs.bottle_tag }}
310-
X86_SHA: ${{ needs.bottle-x86_64.outputs.bottle_sha256 }}
311-
X86_TAG: ${{ needs.bottle-x86_64.outputs.bottle_tag }}
312221
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
313222
run: |
314223
git clone https://x-access-token:${TAP_TOKEN}@github.com/mavlink/homebrew-tap.git tap
@@ -326,7 +235,6 @@ jobs:
326235
bottle do
327236
root_url \"https://github.com/mavlink/mavsim-viewer/releases/download/{tag}\"
328237
sha256 cellar: :any_skip_relocation, {arm64_tag}: \"{arm64_sha}\"
329-
sha256 cellar: :any_skip_relocation, {x86_tag}: \"{x86_sha}\"
330238
end
331239
332240
depends_on \"cmake\" => :build
@@ -349,8 +257,6 @@ jobs:
349257
tarball_sha=os.environ['TARBALL_SHA'],
350258
arm64_sha=os.environ['ARM64_SHA'],
351259
arm64_tag=os.environ['ARM64_TAG'],
352-
x86_sha=os.environ['X86_SHA'],
353-
x86_tag=os.environ['X86_TAG'],
354260
)
355261
with open('tap/Formula/mavsim-viewer.rb', 'w') as f:
356262
f.write(formula)

0 commit comments

Comments
 (0)