Skip to content

Commit 5f7796b

Browse files
committed
[GHA] Workflow to publish group of vscode extensions with the same version
[GHA] Publish all vscode extension for version workflow
1 parent 5bc3832 commit 5f7796b

File tree

1 file changed

+77
-4
lines changed

1 file changed

+77
-4
lines changed

Diff for: .github/workflows/publish-all-vscode-extension-releases.yml

+77-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,86 @@ env:
1616
AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}/spring-tools
1717
DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools
1818

19-
jobs:
19+
permissions:
20+
contents: write
2021

22+
jobs:
2123
publish-vscode-releases:
2224
runs-on: ubuntu-latest
2325
name: Publish '${{ inputs.version }}'
2426
steps:
25-
- name: Search for Releases
26-
id: search-releases
27+
- name: Prepare to Publish
28+
run: |
29+
npm install --global @vscode/vsce
30+
npm install --global ovsx
31+
- name: Search and Publish Releases
32+
id: search-publish-releases
2733
run: |
28-
aws s3 ls s3://$AWS_S3_BUCKET/release/vscode-extensions/
34+
md_file=release-links.md
35+
extensions=`aws s3 ls s3://$AWS_S3_BUCKET/release/vscode-extensions/ | grep '/$'`
36+
for ext_folder in $extensions
37+
do
38+
if [[ "$ext_folder" =~ ^[^[:space:]]+"/"$ ]]; then
39+
ext=${ext_folder%/}
40+
echo "Found extension: '${ext}'"
41+
regex="^${ext}-${{ inputs.version }}-(RC[0-9]*|RELEASE)\.vsix$"
42+
vsix_release_files=`aws s3 ls s3://$AWS_S3_BUCKET/release/vscode-extensions/$ext/${{ inputs.version }}/ | awk '{$1=$2=$3=""; print $0}' | awk '{$1=$1};1' | grep -E "$regex" || true`
43+
if [ -z $vsix_release_files ]; then
44+
echo "[${ext}]: No release builds found for version ${{ inputs.version }}"
45+
else
46+
unset vsix_file
47+
for f in $vsix_release_files
48+
do
49+
if [ -z $vsix_file ]; then
50+
vsix_file=$f
51+
else
52+
unset vsix_file
53+
break
54+
fi
55+
done
56+
if [ -z vsix_file ]; then
57+
echo "[${ext}]: More than one release file found. Skip publishing."
58+
else
59+
echo "[${ext}]: Publishing ${vsix_file}..."
60+
wget -q $DOWNLOAD_URL_ROOT/release/vscode-extensions/$ext/${{ inputs.version }}/$vsix_file
61+
vsce publish -p ${{ secrets.VSCE_PUBLISH_TOKEN }} --packagePath $vsix_file
62+
echo "[${ext}]: Published to VSCode Marketplace"
63+
ovsx publish -p ${{ secrets.OVSX_PUBLISH_TOKEN }} $vsix_file
64+
echo "[${ext}]: Published to Open VSX Marketplace"
65+
echo "- [$vsix_file]($DOWNLOAD_URL_ROOT/release/vscode-extensions/$ext/${{ inputs.version }}/$vsix_file)" >> $md_file
66+
fi
67+
fi
68+
fi
69+
done
70+
if [ -f $md_file ]; then
71+
cat $md_file
72+
echo "links=$md_file" >> $GITHUB_OUTPUT
73+
else
74+
echo "$md_file not updated. No releases published."
75+
fi
76+
- name: Checkout wiki code
77+
if: ${{ steps.search-publish-releases.outputs.links == 'release-links.md' }}
78+
uses: actions/checkout@v4
79+
with:
80+
repository: ${{github.repository}}.wiki
81+
path: markdown
82+
- name: Update Wiki
83+
id: update-wiki
84+
if: ${{ steps.search-publish-releases.outputs.links == 'release-links.md' }}
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
run: |
88+
current_release=${{ github.workspace }}/markdown/Current-VSCode-Releases.md
89+
previous_releases=${{ github.workspace }}/markdown/VSCode-Extensions-Downloads.md
90+
echo -e "\n$(cat ${{ steps.search-publish-releases.outputs.links }})\n" > $current_release
91+
echo -e "### Extensions ${{ inputs.version }}\n\n$(cat ${{ steps.search-publish-releases.outputs.links }})\n\n$(cat $previous_releases)" > $previous_releases
92+
rm -f ${{ steps.search-publish-releases.outputs.links }}
93+
94+
echo "Push Wiki changes in..."
95+
cd markdown
96+
git config --global user.name "@spring-projects/spring-ide-admin"
97+
git add .
98+
git diff-index --quiet HEAD || git commit -m "Publish version ${{ inputs.version }}" && git push
99+
100+
101+

0 commit comments

Comments
 (0)