2626 runs-on : ubuntu-latest
2727 outputs :
2828 version : ${{ steps.release.outputs.number }}
29- published : ${{ steps.marketplace.outputs.published }}
29+ marketplace-published : ${{ steps.marketplace.outputs.published }}
30+ github-released : ${{ steps.github-release.outputs.published }}
3031
3132 steps :
3233 - name : Resolve and verify the VS Code Marketplace release
@@ -110,12 +111,28 @@ jobs:
110111 echo "published=false" >> "$GITHUB_OUTPUT"
111112 fi
112113
114+ - name : Check whether the GitHub release exists
115+ id : github-release
116+ env :
117+ GH_TOKEN : ${{ github.token }}
118+ VERSION : ${{ steps.release.outputs.number }}
119+ shell : bash
120+ run : |
121+ if gh release view "v${VERSION}" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
122+ echo "published=true" >> "$GITHUB_OUTPUT"
123+ echo "GitHub release v${VERSION} already exists."
124+ else
125+ echo "published=false" >> "$GITHUB_OUTPUT"
126+ fi
127+
113128 publish :
114129 name : Publish Zoo Code ${{ needs.prepare.outputs.version }}
115130 needs : prepare
116- if : needs.prepare.outputs.published != 'true'
131+ if : needs.prepare.outputs.marketplace- published != 'true' || needs.prepare.outputs.github-released != 'true'
117132 runs-on : ubuntu-latest
118133 environment : jetbrains-marketplace-production
134+ permissions :
135+ contents : write
119136
120137 steps :
121138 - name : Check out the JetBrains plugin
@@ -144,6 +161,7 @@ jobs:
144161 run : ./scripts/release.sh --mode release --clean
145162
146163 - name : Publish to JetBrains Marketplace
164+ if : needs.prepare.outputs.marketplace-published != 'true'
147165 env :
148166 PUBLISH_TOKEN : ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}
149167 VERSION : ${{ needs.prepare.outputs.version }}
@@ -157,3 +175,27 @@ jobs:
157175 -PvscodePlugin=zoo-code \
158176 -PpluginVersion="$VERSION" \
159177 --no-configuration-cache
178+
179+ - name : Create or update the GitHub release
180+ env :
181+ GH_TOKEN : ${{ github.token }}
182+ VERSION : ${{ needs.prepare.outputs.version }}
183+ shell : bash
184+ run : |
185+ tag="v${VERSION}"
186+ artifact="dist/ZooCode-${VERSION}.zip"
187+ notes="Zoo Code ${VERSION} for JetBrains IDEs. This build packages the stable Zoo Code ${VERSION} VS Code Marketplace release."
188+
189+ test -f "$artifact"
190+
191+ if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
192+ gh release upload "$tag" "$artifact" \
193+ --repo "$GITHUB_REPOSITORY" \
194+ --clobber
195+ else
196+ gh release create "$tag" "$artifact" \
197+ --repo "$GITHUB_REPOSITORY" \
198+ --target "$GITHUB_SHA" \
199+ --title "Zoo Code ${tag}" \
200+ --notes "$notes"
201+ fi
0 commit comments