Skip to content

Commit 8c04a3e

Browse files
(CI) Add publish job
1 parent 1bb11e5 commit 8c04a3e

4 files changed

Lines changed: 178 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Publish Extension
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Compile TypeScript
31+
run: npm run compile
32+
33+
- name: Install vsce and ovsx
34+
run: |
35+
npm install -g @vscode/vsce
36+
npm install -g @openvsx/publish-cli
37+
38+
- name: Package extension
39+
run: npm run package
40+
id: package
41+
42+
- name: Get version from tag or input
43+
id: version
44+
run: |
45+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
46+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
47+
else
48+
VERSION=${GITHUB_REF#refs/tags/v}
49+
echo "version=$VERSION" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Update package.json version
53+
if: github.event_name == 'workflow_dispatch'
54+
run: |
55+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
56+
git config user.name "github-actions[bot]"
57+
git config user.email "github-actions[bot]@users.noreply.github.com"
58+
git add package.json
59+
git commit -m "Bump version to ${{ github.event.inputs.version }}" || exit 0
60+
git push || exit 0
61+
62+
- name: Publish to VS Code Marketplace
63+
env:
64+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
65+
run: |
66+
vsce publish -p $VSCE_PAT
67+
68+
- name: Publish to OpenVSX Registry
69+
env:
70+
OVSX_PAT: ${{ secrets.OPENVSX_TOKEN }}
71+
run: |
72+
ovsx publish -p $OVSX_PAT
73+
74+
- name: Upload VSIX artifact
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: extension-vsix
78+
path: '*.vsix'
79+
retention-days: 30
80+
81+
- name: Announce release on Zulip
82+
if: success()
83+
env:
84+
ZULIP_BOT_TOKEN: ${{ secrets.ZULIP_RELEASES_BOT_TOKEN }}
85+
run: |
86+
chmod +x scripts/announce-release.sh
87+
./scripts/announce-release.sh "${{ steps.version.outputs.version }}" "${{ secrets.ZULIP_RELEASES_BOT_TOKEN }}"

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Makefile
1414
package-lock.json
1515
docs/**
1616
.github/**
17+
scripts/

docs/docs/content/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ All notable changes to RayforceDB VS Code Extension will be documented in this f
88

99
## **`0.4.0`**
1010

11-
- Added full Rayfall language support with syntax highlighting and autocomplete
12-
- Improved REPL integration with environment variable inspection
1311
- Enhanced instance manager with folder organization for saved instances
12+
- Fixed deserialization issues with Time Date and Timestamp types in Typescript IPC
13+
- Improved REPL integration with environment variable inspection
1414
- Added custom file icons for `.rfl` and `.rf` files
15+
- Added full Rayfall language support with syntax highlighting and autocomplete
1516

1617
2025-01-XX | **[🔗 VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=RayforceDB.rayforce-vscode)** | **[🔗 GitHub](https://github.com/RayforceDB/rayforce-vscode/releases/tag/0.4.0)**
1718

scripts/announce-release.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
3+
# Usage: ./announce-release.sh VERSION [BOT_API_KEY]
4+
5+
VERSION=${1}
6+
BOT_API_KEY=${2}
7+
8+
if [ -z "$VERSION" ]; then
9+
echo "Error: VERSION is required"
10+
echo "Usage: $0 VERSION [BOT_API_KEY]"
11+
exit 1
12+
fi
13+
14+
if [ -z "$BOT_API_KEY" ]; then
15+
echo "Error: BOT_API_KEY is required"
16+
echo "Usage: $0 VERSION BOT_API_KEY"
17+
exit 1
18+
fi
19+
20+
# Get the script directory to find CHANGELOG
21+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
23+
# Try docs location first, then project root
24+
CHANGELOG="${PROJECT_ROOT}/docs/docs/content/CHANGELOG.md"
25+
if [ ! -f "${CHANGELOG}" ]; then
26+
CHANGELOG="${PROJECT_ROOT}/CHANGELOG.md"
27+
fi
28+
if [ ! -f "${CHANGELOG}" ]; then
29+
CHANGELOG="${PROJECT_ROOT}/CHANGELOG"
30+
fi
31+
32+
if [ ! -f "${CHANGELOG}" ]; then
33+
echo "Warning: CHANGELOG not found at ${CHANGELOG}"
34+
CHANGELOG_CONTENT=""
35+
else
36+
ESCAPED_VERSION=$(echo "${VERSION}" | sed 's/\./\\./g')
37+
38+
CHANGELOG_CONTENT=$(awk -v version="${ESCAPED_VERSION}" '
39+
BEGIN { collecting=0; found_version=0 }
40+
{
41+
# Start collecting when we find the version line
42+
# Pattern: ## **`VERSION`**
43+
if ($0 ~ "^## \\*\\*`" version "`\\*\\*") {
44+
collecting=1
45+
found_version=1
46+
print
47+
next
48+
}
49+
# Stop collecting at next version entry
50+
if (collecting && /^## \*\*\`/) {
51+
exit
52+
}
53+
# Collect lines while we are in the version section
54+
if (collecting) {
55+
print
56+
}
57+
}
58+
END {
59+
if (!found_version) {
60+
exit 1
61+
}
62+
}
63+
' "${CHANGELOG}")
64+
65+
if [ $? -ne 0 ] || [ -z "${CHANGELOG_CONTENT}" ]; then
66+
echo "Warning: No changelog entry found for version ${VERSION}"
67+
CHANGELOG_CONTENT=""
68+
fi
69+
fi
70+
71+
CONTENT="**New Rayforce-VSCode Version is Released!**"
72+
73+
if [ -n "${CHANGELOG_CONTENT}" ]; then
74+
CONTENT="${CONTENT}
75+
76+
${CHANGELOG_CONTENT}"
77+
fi
78+
79+
curl -X POST https://rayforcedb.zulipchat.com/api/v1/messages \
80+
-u releases-bot@rayforcedb.zulipchat.com:${BOT_API_KEY} \
81+
-d type=stream \
82+
-d "to=Announcements" \
83+
-d topic="Rayforce-VSCode" \
84+
-d "content=${CONTENT}"
85+
86+
echo ""
87+
echo "✅ Announcement sent to Zulip!"

0 commit comments

Comments
 (0)