Skip to content

Commit

Permalink
feat: create dev builds with hmr (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrani authored Sep 5, 2023
1 parent 15764d4 commit e2d7942
Show file tree
Hide file tree
Showing 10 changed files with 907 additions and 19 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ jobs:
- name: Update Version
if: steps.semver.outputs.version != ''
run: |
jq --arg chromeVersion "${{ steps.semver.outputs.version }}" \
'.version = $chromeVersion' chrome/manifest.json > chrome/tmp && \
mv chrome/tmp chrome/manifest.json
# Package
jq --arg version "${{ steps.semver.outputs.version }}" \
'.version = $version' package.json > tmp && \
mv tmp package.json
jq --arg firefoxVersion "${{ steps.semver.outputs.version }}" \
'.version = $firefoxVersion' firefox/manifest.json > firefox/tmp && \
mv firefox/tmp firefox/manifest.json
# Chrome
jq --arg version "${{ steps.semver.outputs.version }}" \
'.version = $version' src/manifest.chrome.json > tmp && \
mv tmp src/manifest.chrome.json
# Firefox
jq --arg version "${{ steps.semver.outputs.version }}" \
'.version = $version' src/manifest.firefox.json > tmp && \
mv tmp src/manifest.firefox.json
- name: Commit Changes
if: steps.semver.outputs.version != ''
Expand Down Expand Up @@ -59,11 +66,19 @@ jobs:
- name: Archive Extension Files
if: steps.semver.outputs.version != ''
run: |
(cd src && zip -r ../Chorus-Chrome.zip .)
(cd chrome && zip -j ../Chorus-Chrome.zip manifest.json)
# Chrome Zip
cp -r src chrome_temp
rm chrome_temp/manifest.firefox.json
mv chrome_temp/manifest.chrome.json chrome_temp/manifest.json
zip -r chorus-chrome.zip chrome_temp/
rm -rf chrome_temp/
(cd src && zip -r ../Chorus-FireFox.zip .)
(cd firefox && zip -j ../Chorus-FireFox.zip manifest.json)
# Firefox Zip
cp -r src firefox_temp
rm firefox_temp/manifest.chrome.json
mv firefox_temp/manifest.firefox.json firefox_temp/manifest.json
zip -r chorus-firefox.zip firefox_temp/
rm -rf firefox_temp/
- name: Create Release Archive & Notes
if: steps.semver.outputs.version != ''
Expand All @@ -72,14 +87,14 @@ jobs:
tag: ${{ steps.semver.outputs.git_tag }}
name: ${{ steps.semver.outputs.git_tag }}
body: ${{ steps.semver.outputs.notes }}
artifacts: 'Chorus-Chrome.zip,Chorus-FireFox.zip'
artifacts: 'chorus-chrome.zip,chorus-firefox.zip'

- name: Upload & Publish
if: steps.semver.outputs.version != ''
uses: cdrani/chrome-extension-upload@ci/silent-update-fail
with:
silent-fail: true
file-path: Chorus-Chrome.zip
file-path: chorus-chrome.zip
client-id: ${{ secrets.CLIENT_ID }}
extension-id: ${{ secrets.EXTENSION_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.zip
*.DS_STORE
Chorus-Chrome
Chorus-FireFox
node_modules
chrome
firefox
Empty file removed chrome/manifest.json
Empty file.
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "chorus",
"private": true,
"type": "module",
"version": "1.6.1",
"scripts": {
"build:chrome": "TARGET=chrome rollup -c",
"watch:chrome": "TARGET=chrome rollup -c -w",
"build:firefox": "TARGET=firefox rollup -c",
"watch:firefox": "TARGET=firefox rollup -c -w"
},
"devDependencies": {
"rollup": "3.28.1",
"rollup-plugin-chrome-extension": "3.6.12"
}
}

Loading

0 comments on commit e2d7942

Please sign in to comment.