Skip to content

Commit

Permalink
feat: refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew den Hertog <[email protected]>
  • Loading branch information
andrewhertog committed Sep 18, 2024
1 parent 09685d1 commit c2ebba4
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 211 deletions.
77 changes: 66 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,88 @@ on:
push:
branches:
- main
- feat/ci
env:
GH_TOKEN: ${{ github.token }}

jobs:
build:
check-release:
runs-on: ubuntu-latest
outputs:
release_exists: ${{ steps.release.outputs.exists }}
openvsx_exists: ${{ steps.openvsx.outputs.exists }}
package_version: ${{ env.PKG_VERSION }}
package_name: ${{ env.PKG_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get Current Version
id: get_version
run: |
echo "PKG_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
echo "PKG_NAME=$(jq -r '.name' package.json)" >> $GITHUB_ENV
- name: Check Release
id: release
run: |
set -x
if gh release view $PKG_VERSION ; then
echo "Release already exists"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Release does not exist"
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Check OpenVSX
id: openvsx
run: |
set -x
if npx ovsx get ${{ github.repository_owner }}.$PKG_NAME -v $PKG_VERSION; then
echo "OpenVSX already exists"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "OpenVSX does not exist"
echo "exists=false" >> $GITHUB_OUTPUT
fi
build:
runs-on: ubuntu-latest
needs: check-release
if: ${{ needs.check-release.outputs.release_exists == 'false' || needs.check-release.outputs.openvsx_exists == 'false' }}
env:
PKG_VERSION: ${{ needs.check-release.outputs.package_version }}
PKG_NAME: ${{ needs.check-release.outputs.package_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Update Publisher
run: jq '.publisher = "${{ github.repository_owner }}"' package.json > package.json.tmp && mv package.json.tmp package.json
if: ${{ github.repository_owner != 'genesis-ai-dev' }}

- name: Update Version
run: |
current_version=$(jq -r '.version' package.json)
new_version=$(npx semver $current_version -i patch)
jq -r '.version = '\"${new_version}\"'' package.json > package.json.tmp && mv package.json.tmp package.json

- name: Install dependencies
run: npx pnpm -r install
run: |
npm i
cd webviews/codex-webviews
npm i
cd ../obs
npm i
cd ../usfm-viewer
npm i -f
- name: Package
run: npx vsce package

- name: Publish to OpenVSX
if: ${{ needs.check-release.outputs.openvsx_exists == 'false' }}
run: |
npx ovsx publish -p ${{ secrets.OPENVSX_TOKEN }} ${{ env.PKG_NAME }}-${{ env.PKG_VERSION }}.vsix
- name: Create Release
if: ${{ needs.check-release.outputs.release_exists == 'false' }}
run: |
npx ovsx publish --no-dependencies -p ${{ secrets.OPENVSX_TOKEN }}
gh release create ${{ env.PKG_VERSION }} --generate-notes *.vsix
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@
]
},
"scripts": {
"vscode:prepublish": "npm run build:ci && npm run compile",
"vscode:prepublish": "npm run build:webviews && npm run compile",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
Expand All @@ -772,8 +772,9 @@
"format": "prettier --write .",
"build:table": "cd webviews/editable-react-table && npm run build",
"build:dictionary-side": "cd webviews/dictionary-side-panel && npm run build",
"build:webviews": "cd webviews/codex-webviews && pnpm run build:all && cd ../dictionary-side-panel && pnpm run build && cd ../editable-react-table && pnpm run build && cd ../usfm-viewer && pnpm run build && cd ../..",
"build:ci": "pnpm -r --filter='./webviews/*' run build"
"build:webviews": "cd webviews/codex-webviews && pnpm run build:all && cd ../usfm-viewer && pnpm run build && cd ../obs && pnpm run build && cd ../..",
"build:ci": "pnpm -r --filter='./webviews/*' run build",
"build": "npm run compile"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
Expand Down
2 changes: 0 additions & 2 deletions pnpm-workspaces.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ type DictionaryPostMessages =
wordFrequencies: { [key: string]: number };
}
| { command: "updateDictionary"; content: Dictionary }
| { command: "updateData"; data: Dictionary }
| { command: "confirmRemove"; count: number }
| { command: "removeConfirmed" }

type DictionaryReceiveMessages =
| { command: "providerTellsWebviewRemoveConfirmed" }
Expand Down
2 changes: 1 addition & 1 deletion webviews/obs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "webview-ui",
"name": "obs-webview-ui",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion webviews/usfm-viewer/build/assets/index.css

Large diffs are not rendered by default.

382 changes: 191 additions & 191 deletions webviews/usfm-viewer/build/assets/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webviews/usfm-viewer/build/assets/views/BibleNavigator.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webviews/usfm-viewer/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "webview-ui",
"name": "usfm-viewer-webview-ui",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down

0 comments on commit c2ebba4

Please sign in to comment.