-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
116 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,34 +33,34 @@ jobs: | |
with: | ||
target-branch: master | ||
|
||
- name: Run build | ||
run: npm run build | ||
|
||
- name: Create distribution folder | ||
run: | | ||
mkdir fun.shiro.ytmd.sdPlugin | ||
copy sdpi.css fun.shiro.ytmd.sdPlugin\ | ||
copy manifest.json fun.shiro.ytmd.sdPlugin\ | ||
copy property-inspector.html fun.shiro.ytmd.sdPlugin\ | ||
copy action.html fun.shiro.ytmd.sdPlugin\ | ||
copy bundle.js fun.shiro.ytmd.sdPlugin\ | ||
copy bundle-pi.js fun.shiro.ytmd.sdPlugin\ | ||
copy icons fun.shiro.ytmd.sdPlugin -Recurse | ||
- name: Download Stream Deck Distribution Tool | ||
uses: carlosperate/[email protected] | ||
with: | ||
file-url: https://developer.elgato.com/documentation/stream-deck/distributiontool/DistributionToolWindows.zip | ||
file-name: distribution-tool.zip | ||
|
||
- name: Unzip Stream Deck Distribution Tool | ||
run: tar -xf .\distribution-tool.zip | ||
|
||
- name: Validate plugin and build .streamDeckPlugin file | ||
run: ./DistributionTool.exe -b -i fun.shiro.ytmd.sdPlugin -o ./ | ||
|
||
- name: Upload Release Artifact | ||
if: ${{ steps.release.outputs.release_created }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release upload ${{ steps.release.outputs.tag_name }} ./fun.shiro.ytmd.streamDeckPlugin --clobber | ||
# - name: Run build | ||
# run: npm run build | ||
# | ||
# - name: Create distribution folder | ||
# run: | | ||
# mkdir fun.shiro.ytmd.sdPlugin | ||
# copy sdpi.css fun.shiro.ytmd.sdPlugin\ | ||
# copy manifest.json fun.shiro.ytmd.sdPlugin\ | ||
# copy property-inspector.html fun.shiro.ytmd.sdPlugin\ | ||
# copy action.html fun.shiro.ytmd.sdPlugin\ | ||
# copy bundle.js fun.shiro.ytmd.sdPlugin\ | ||
# copy bundle-pi.js fun.shiro.ytmd.sdPlugin\ | ||
# copy icons fun.shiro.ytmd.sdPlugin -Recurse | ||
# | ||
# - name: Download Stream Deck Distribution Tool | ||
# uses: carlosperate/[email protected] | ||
# with: | ||
# file-url: https://developer.elgato.com/documentation/stream-deck/distributiontool/DistributionToolWindows.zip | ||
# file-name: distribution-tool.zip | ||
# | ||
# - name: Unzip Stream Deck Distribution Tool | ||
# run: tar -xf .\distribution-tool.zip | ||
# | ||
# - name: Validate plugin and build .streamDeckPlugin file | ||
# run: ./DistributionTool.exe -b -i fun.shiro.ytmd.sdPlugin -o ./ | ||
# | ||
# - name: Upload Release Artifact | ||
# if: ${{ steps.release.outputs.release_created }} | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# run: gh release upload ${{ steps.release.outputs.tag_name }} ./fun.shiro.ytmd.streamDeckPlugin --clobber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
node_modules/ | ||
dist/ | ||
coverage/ | ||
build/ | ||
bundle.js | ||
bundle-pi.js | ||
fun.shiro.ytmd.sdPlugin/ | ||
DistributionTool.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
const fs = require('fs'); | ||
const browserify = require('../node_modules/browserify'); | ||
const tsify = require('../node_modules/tsify'); | ||
const {minify_sync} = require('../node_modules/terser'); | ||
const {execSync} = require('child_process'); | ||
// Create release folder | ||
console.log('Creating release folder'); | ||
if (fs.existsSync('build')) { | ||
execSync('rmdir /s /q build'); | ||
} | ||
fs.mkdirSync('build'); | ||
|
||
// Create plugin folder | ||
console.log('Creating plugin folder'); | ||
if (fs.existsSync('build/fun.shiro.ytmd.sdPlugin')) { | ||
execSync('rmdir /s /q build/fun.shiro.ytmd.sdPlugin'); | ||
} | ||
fs.mkdirSync('build/fun.shiro.ytmd.sdPlugin'); | ||
|
||
// Build plugin | ||
console.log('Building plugin'); | ||
|
||
// I know, this is a mess, but it works. | ||
browserify({entries: ['src/ytmd-pi.ts'], plugin: [tsify]}).bundle((err, buf) => { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
const minified = minify_sync(buf.toString(), { | ||
mangle: { | ||
toplevel: true | ||
}, | ||
output: { | ||
comments: false | ||
} | ||
}); | ||
if (minified.error) { | ||
console.error(minified.error); | ||
return; | ||
} | ||
fs.writeFileSync('build/fun.shiro.ytmd.sdPlugin/bundle-pi.js', minified.code); | ||
|
||
browserify({entries: ['src/ytmd.ts'], plugin: [tsify]}).bundle((err, buf) => { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
const minified = minify_sync(buf.toString(), { | ||
mangle: { | ||
toplevel: true | ||
}, | ||
output: { | ||
comments: false | ||
} | ||
}); | ||
if (minified.error) { | ||
console.error(minified.error); | ||
return; | ||
} | ||
fs.writeFileSync('build/fun.shiro.ytmd.sdPlugin/bundle.js', minified.code); | ||
|
||
// Copy files | ||
console.log('Copying files'); | ||
fs.copyFileSync('sdpi.css', 'build/fun.shiro.ytmd.sdPlugin/sdpi.css'); | ||
fs.copyFileSync('manifest.json', 'build/fun.shiro.ytmd.sdPlugin/manifest.json'); | ||
fs.copyFileSync('property-inspector.html', 'build/fun.shiro.ytmd.sdPlugin/property-inspector.html'); | ||
fs.copyFileSync('action.html', 'build/fun.shiro.ytmd.sdPlugin/action.html'); | ||
fs.cpSync('icons', 'build/fun.shiro.ytmd.sdPlugin/icons', {recursive: true}); | ||
|
||
// Run distribution tool | ||
console.log('Running distribution tool'); | ||
execSync('DistributionTool.exe -b -i build/fun.shiro.ytmd.sdPlugin -o build'); | ||
|
||
// Clean up | ||
console.log('Cleaning up'); | ||
fs.rmSync('build/fun.shiro.ytmd.sdPlugin', {recursive: true}); | ||
|
||
// Done building release, check the build folder | ||
console.log('Done building release, check the build folder'); | ||
}); | ||
}); |