Skip to content

Commit b667696

Browse files
committed
Adopt CI from intersystems/language-server
1 parent 52bf681 commit b667696

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ concurrency:
2222

2323
jobs:
2424
build:
25-
timeout-minutes: 10
2625
runs-on: ubuntu-latest
26+
timeout-minutes: 10
2727
strategy:
2828
matrix:
2929
include:
@@ -127,51 +127,63 @@ jobs:
127127
prerelease: ${{ github.event_name != 'release' }}
128128
files: '**/*.vsix'
129129
token: ${{ secrets.GITHUB_TOKEN }}
130+
130131
publish:
132+
runs-on: ubuntu-latest
131133
needs: build
132-
if: github.event_name == 'release' && needs.build.outputs.taggedbranch == 'master'
134+
if: success() && github.event_name == 'release'
135+
steps:
136+
- name: Use Node.js
137+
uses: actions/setup-node@v4
138+
with:
139+
node-version: 18
140+
- run: npm install -g @vscode/vsce
141+
- name: Download packages
142+
uses: actions/download-artifact@v4
143+
- name: Attach packages to release
144+
uses: softprops/action-gh-release@v2
145+
with:
146+
tag_name: ${{ github.event.release.tag_name }}
147+
files: '**/*.vsix'
148+
body: See CHANGELOG for details
149+
token: ${{ secrets.GITHUB_TOKEN }}
150+
- name: Publish to VS Code Marketplace
151+
env:
152+
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
153+
if: env.VSCE_PAT != null
154+
run: vsce publish --packagePath $(find . -iname "*.vsix" -type f)
155+
- name: Publish to Open VSX Registry
156+
env:
157+
OVSX_PAT: ${{ secrets.OVSX_TOKEN }}
158+
if: env.OVSX_PAT != null
159+
timeout-minutes: 5
160+
run: find . -iname "*.vsix" -type f -exec npx ovsx publish {} \;
161+
bump_version:
133162
runs-on: ubuntu-latest
163+
needs: [build, publish]
164+
if: github.event_name == 'release'
134165
steps:
135-
- uses: actions/checkout@v4
166+
- name: Check out repository
167+
uses: actions/checkout@v4
136168
with:
137169
ref: master
138-
token: ${{ secrets.TOKEN }}
139-
- uses: actions/download-artifact@v4
170+
- name: Download metadata
171+
uses: actions/download-artifact@v4
140172
with:
141173
name: meta
142174
path: .
143175
- name: Use Node.js
144176
uses: actions/setup-node@v4
145177
with:
146178
node-version: 18
147-
- name: Prepare build
148-
id: set-version
179+
- name: Create commit
149180
run: |
150181
VERSION=`cat meta.version`
151182
NEXT_VERSION=`cat meta.version | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
152-
echo "name=`cat meta.name`" >> $GITHUB_OUTPUT
153183
tmp=$(mktemp)
154184
git config --global user.name 'ProjectBot'
155185
git config --global user.email '[email protected]'
156186
jq --arg version "${NEXT_VERSION}-SNAPSHOT" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
157187
git add package.json
158-
git commit -m 'auto bump version with release'
159-
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
160-
npm install
161-
jq 'del(.enableProposedApi,.enabledApiProposals)' package.json > "$tmp" && mv "$tmp" package.json
162-
git push
163-
- name: Build package
164-
run: |
165-
npx vsce package -o ${{ steps.set-version.outputs.name }}.vsix
166-
- name: Upload Release Asset
167-
id: upload-release-asset
168-
uses: softprops/action-gh-release@v1
169-
if: runner.os == 'LinuxTODO'
170-
with:
171-
tag_name: ${{ github.event.release.tag_name }}
172-
files: ${{ steps.set-version.outputs.name }}.vsix
173-
token: ${{ secrets.GITHUB_TOKEN }}
174-
- name: Publish to VSCode Marketplace
175-
run: |
176-
[ -n "${{ secrets.VSCE_TOKEN }}" ] && \
177-
npx vsce publish --packagePath ${{ steps.set-version.outputs.name }}.vsix -p ${{ secrets.VSCE_TOKEN }} || true
188+
git commit -m 'auto bump version with release [skip ci]'
189+
git push

0 commit comments

Comments
 (0)