@@ -3,13 +3,36 @@ name: Release
33on :
44 release :
55 types : [published]
6+ workflow_dispatch :
67
78permissions :
89 contents : write # Required for electron-builder to upload release assets
910
11+ env :
12+ RELEASE_TAG : ${{ github.event.release.tag_name || github.ref_name }}
13+
1014jobs :
15+ preflight :
16+ name : Validate release target
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Ensure release tag context
20+ run : |
21+ if [ -z "$RELEASE_TAG" ]; then
22+ echo "::error::RELEASE_TAG is empty. Ensure this workflow runs on a release event or refs/tags/* ref."
23+ exit 1
24+ fi
25+
26+ if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [[ "$GITHUB_REF" != refs/tags/* ]]; then
27+ echo "::error::workflow_dispatch runs must target a tag ref. Current ref: $GITHUB_REF"
28+ exit 1
29+ fi
30+
31+ echo "Publishing tag $RELEASE_TAG"
32+
1133 build-macos :
1234 name : Build and Release macOS
35+ needs : preflight
1336 runs-on : ${{ github.repository_owner == 'coder' && 'depot-macos-15' || 'macos-latest' }}
1437 steps :
1538 - name : Checkout code
3861
3962 build-linux :
4063 name : Build and Release Linux
64+ needs : preflight
4165 runs-on : ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
4266 steps :
4367 - name : Checkout code
5781
5882 build-vscode-extension :
5983 name : Build and Release VS Code Extension
84+ needs :
85+ - preflight
86+ - build-macos
6087 runs-on : ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
6188 steps :
6289 - name : Checkout code
@@ -68,24 +95,46 @@ jobs:
6895
6996 - uses : ./.github/actions/build-vscode-extension
7097
98+ - name : Wait for GitHub release
99+ env :
100+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101+ run : |
102+ for attempt in $(seq 1 30); do
103+ if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
104+ echo "Release $RELEASE_TAG is available"
105+ exit 0
106+ fi
107+
108+ echo "Release $RELEASE_TAG not found yet (attempt $attempt/30); waiting 10s..."
109+ sleep 10
110+ done
111+
112+ echo "::error::Timed out waiting for release $RELEASE_TAG"
113+ exit 1
114+
71115 - name : Upload VS Code extension to release
72116 env :
73117 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
74118 run : |
75- gh release upload ${{ github.event.release.tag_name }} \
119+ gh release upload "$RELEASE_TAG" \
76120 vscode/mux-*.vsix \
77121 --clobber
78122
79123 - name : Publish to VS Code Marketplace
80- if : ${{ secrets.VSCE_PAT != '' }}
81124 working-directory : vscode
82125 env :
83126 VSCE_PAT : ${{ secrets.VSCE_PAT }}
84127 run : |
85- bunx vsce publish -p $VSCE_PAT
128+ if [ -z "$VSCE_PAT" ]; then
129+ echo "VSCE_PAT secret is not set; skipping VS Code Marketplace publish."
130+ exit 0
131+ fi
132+
133+ bunx vsce publish -p "$VSCE_PAT"
86134
87135 build-windows :
88136 name : Build and Release Windows
137+ needs : preflight
89138 runs-on : windows-latest
90139 steps :
91140 - name : Checkout code
0 commit comments