Skip to content

Commit 76313d0

Browse files
committed
publish release to github as well
1 parent b1d929f commit 76313d0

2 files changed

Lines changed: 50 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
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

BUILD.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ containing this payload:
125125

126126
The workflow independently verifies that the requested stable version exists
127127
on the VS Code Marketplace, skips versions already uploaded to JetBrains, runs
128-
`./scripts/release.sh --mode release --clean`, and publishes the resulting ZIP.
129-
It can also be run manually with a version from the Actions page to recover from
130-
a missed dispatch or retry a failed release.
128+
`./scripts/release.sh --mode release --clean`, publishes the resulting ZIP to
129+
JetBrains Marketplace, and creates a matching `v<version>` GitHub release with
130+
the ZIP attached. Both destinations are checked independently, so a retry can
131+
repair a missing Marketplace upload or GitHub release without duplicating the
132+
other. The workflow can also be run manually with a version from the Actions
133+
page to recover from a missed dispatch or retry a failed release.
131134

132135
Configure the `jetbrains-marketplace-production` GitHub environment and add its
133136
`JETBRAINS_MARKETPLACE_TOKEN` secret. The token must be a permanent JetBrains

0 commit comments

Comments
 (0)