Skip to content

Commit

Permalink
Debugging build
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanH committed May 4, 2023
1 parent 6d781d9 commit cd16bb0
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 756 deletions.
160 changes: 20 additions & 140 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,72 +33,31 @@ jobs:
id: create_tag
run: |
if [[ "$(basename "${{ github.ref }}")" == "main" ]]; then
tag=${{ fromJson(steps.package_json.outputs.json).version }}
tag=v${{ fromJson(steps.package_json.outputs.json).version }}
else
tag=$(basename "${{ github.ref }}")-${{ fromJson(steps.package_json.outputs.json).version }}-$(date +%Y%m%d.%H%M%S)
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: ${{ steps.create_tag.outputs.tag }}
draft: true
prerelease: "${{ steps.create_tag.outputs.tag != fromJson(steps.package_json.outputs.json).version }}"

build-linux:
needs: [prep-release]
runs-on: ubuntu-latest
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ steps.create_tag.outputs.tag }}
# release_name: ${{ steps.create_tag.outputs.tag }}
# draft: true
# prerelease: "${{ steps.create_tag.outputs.tag != fromJson(steps.package_json.outputs.json).version }}"

# Platform-agnostic build
steps:
- uses: actions/checkout@v3
- uses: mskelton/setup-yarn@v1.4.0
with:
node-version: "${{ env.NODE_VERSION }}"
- run: make install
- run: make publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Linux: .tar.gz
- uses: tj-actions/glob@v17
id: glob_targz
with:
working-directory: ./dist_electron/
files: unofficial-homestuck-collection-*.tar.gz
- uses: actions/upload-release-asset@v1
if: steps.glob_targz.outputs.paths != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prep-release.outputs.upload_url }}
asset_path: ./dist_electron/${{ steps.glob_targz.outputs.paths }}
asset_name: ${{ steps.glob_targz.outputs.paths }}
asset_content_type: application/gzip

# Linux: .AppImage
- uses: tj-actions/glob@v17
id: glob_appimage
with:
working-directory: ./dist_electron/
files: "*.AppImage"
- uses: actions/upload-release-asset@v1
if: steps.glob_appimage.outputs.paths != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prep-release.outputs.upload_url }}
asset_path: ./dist_electron/${{ steps.glob_appimage.outputs.paths }}
asset_name: ${{ steps.glob_appimage.outputs.paths }}
asset_content_type: application/octet-stream
build-matrix:
needs: [ prep-release ]
strategy:
fail-fast: false
matrix:
node-version: [14.18]
os: [ ubuntu-latest, windows-latest, macos-latest ]

build-windows:
needs: [prep-release]
runs-on: windows-latest
runs-on: ${{ matrix.os }}

# Platform-agnostic build
steps:
Expand All @@ -107,85 +66,6 @@ jobs:
with:
node-version: "${{ env.NODE_VERSION }}"
- run: make install
- run: make publish
- run: make publish_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Windows: win-x64.zip
- uses: tj-actions/glob@v17
id: glob_winzip64
with:
working-directory: ./dist_electron/
files: "*-win-x64.zip"
- uses: actions/upload-release-asset@v1
if: steps.glob_winzip64.outputs.paths != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prep-release.outputs.upload_url }}
asset_path: ./dist_electron/${{ steps.glob_winzip64.outputs.paths }}
asset_name: ${{ steps.glob_winzip64.outputs.paths }}
asset_content_type: application/zip

# Windows: win-x64.zip
- uses: tj-actions/glob@v17
id: glob_winzip32
with:
working-directory: ./dist_electron/
files: "*-win-ia32.zip"
- uses: actions/upload-release-asset@v1
if: steps.glob_winzip32.outputs.paths != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prep-release.outputs.upload_url }}
asset_path: ./dist_electron/${{ steps.glob_winzip32.outputs.paths }}
asset_name: ${{ steps.glob_winzip32.outputs.paths }}
asset_content_type: application/zip

build-osx:
needs: [prep-release]
runs-on: macos-latest

# Platform-agnostic build
steps:
- uses: actions/checkout@v3
- uses: mskelton/setup-yarn@v1.4.0
with:
node-version: "${{ env.NODE_VERSION }}"
- run: make install
# - run: make publish
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - uses: tj-actions/glob@v17
# id: glob_dmg
# with:
# working-directory: ./dist_electron/
# files: "*.dmg"
# - uses: actions/upload-release-asset@v1
# if: steps.glob_dmg.outputs.paths != ''
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.prep-release.outputs.upload_url }}
# asset_path: ./dist_electron/${{ steps.glob_dmg.outputs.paths }}
# asset_name: ${{ steps.glob_dmg.outputs.paths }}
# asset_content_type: application/octet-stream

metadata:
name: Publish Release
needs: [prep-release, build-windows, build-linux, build-osx]
runs-on: ubuntu-latest
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.prep-release.outputs.release_id }}
# - uses: eregon/keep-last-n-releases@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# n: 3
# remove_tags_without_release: true
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
CONFIG_JSON_PATH = "${APPDATA}/unofficial-homestuck-collection/config.json"

default: test

# We do actually use a dummy install file to track this
install: package.json yarn.lock
yarn install --ignore-optional
touch install

clean:
rm install
rm -r src/imods.tar
-rm ./install src/imods.tar
-rm -r dist/ dist_electron/*/

lint: install
yarn run vue-cli-service lint
Expand All @@ -17,23 +20,27 @@ test: install src/imods.tar
yarn run vue-cli-service electron:serve $(SERVE_FLAGS)
# yarn dev

publish: install src/imods.tar
build: install src/imods.tar
yarn run vue-cli-service electron:build
# yarn electron:build

publish_release: install src/imods.tar
yarn run vue-cli-service electron:build -p always

vuebuild: install
vuebuild: install src/imods.tar
yarn run vue-cli-service build

src/imods.tar: $(wildcard src/imods/*) $(wildcard src/imods/*/*)
cd src && tar -czf imods.tar imods/
-jq '.appVersion = "2.0.0"' ${CONFIG_JSON_PATH} > ${CONFIG_JSON_PATH}.tmp
-mv ${CONFIG_JSON_PATH}.tmp ${CONFIG_JSON_PATH}


help:
@echo 'Usage: '
@echo 'Usage:'
@echo ' make clean try to clean old build artifacts'
@echo ' make test start a development version now'
@echo ' make publish create a production version'
@echo ' make build create a production version'
@echo ' make lint lints and fixes files'


.PHONY: clean test publish help lint test
.PHONY: clean test build publish help lint test
31 changes: 19 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@
"electron:serve": "vue-cli-service electron:serve",
"electron:generate-icons": "electron-icon-builder --input=./public/icon.png --output=build --flatten",
"dev": "vue-cli-service electron:serve",
"postinstall": "echo skipping: electron-builder install-app-deps",
"postuninstall": "echo skipping: electron-builder install-app-deps"
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
},
"main": "background.js",
"dependencies": {
"@babel/core": "^7.0.0-0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.21.4",
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/vue-fontawesome": "^0.1.10",
"babel-loader": "^8.1.2",
"chokidar": "^3.5.3",
"electron-log": "^4.4.8",
"electron-store": "^8.1.0",
Expand All @@ -46,11 +41,15 @@
"mark.js": "^8.11.1",
"mnemonist": "^0.39.5",
"module": "^1.2.5",
"node-loader": "^1.0.3",
"prettier": "^1.18.2",
"readline": "^1.3.0",
"sass": "^1.62.0",
"sass": "^1.62.1",
"serve-handler": "^6.1.3",
"sharp": "^0.32.0",
"sharp": "^0.32.1",
"tar": "^6.1.11",
"terser": "^4.8.0",
"terser-webpack-plugin": "^3.0.3",
"ts-color-class": "^0.10.1",
"unzipper": "^0.10.11",
"url-loader": "^4.1.1",
Expand All @@ -59,13 +58,18 @@
"vue-router": "^3.2.0",
"vue-simple-suggest": "^1.11.1",
"vuedraggable": "^2.24.3",
"watchpack-chokidar2": "^2.0.0"
"watchpack-chokidar2": "^2.0.1"
},
"devDependencies": {
"@babel/core": "^7.0.0-0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.21.4",
"@vue/cli-plugin-router": "~4.4.0",
"@vue/cli-service": "~4.4.0",
"@vue/devtools": "^6.5.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-loader": "^8.1.2",
"electron": "^9.0.0",
"electron-devtools-installer": "^3.1.0",
"electron-icon-builder": "^1.0.2",
Expand All @@ -78,8 +82,11 @@
"eslint-plugin-vue": "^7.8.0",
"node-sass": "^7.0.1",
"sass-loader": "^10.2.1",
"vue-cli-plugin-electron-builder": "~2.0.0-rc.4",
"vue-cli-plugin-electron-builder": "~2.1.1",
"vue-template-compiler": "^2.7",
"webpack": "^5.0.0"
"webpack": "^4.18.0"
},
"resolutions": {
"vue-cli-plugin-electron-builder/electron-builder": "^23.0.2"
}
}
9 changes: 8 additions & 1 deletion src/mods.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ function extractimods(){
// TODO: Some people report occasionally getting "__webpack_require__.match is not a function or its return value is not iterable" at this line. Have not been able to reproduce the error so far.

// eslint-disable-next-line import/no-webpack-loader-syntax
const [match, contentType, base64] = require("url-loader!./imods.tar").default.match(/^data:(.+);base64,(.*)$/)
let tardata
try {
tardata = require("url-loader!./imods.tar").default // Require *must* have a literal string here
} catch (e) {
logger.error(`Couldn't read bundled tar data from url-loader!./imods.tar: webpack issue?`)
throw e
}
const [match, contentType, base64] = tardata.match(/^data:(.+);base64,(.*)$/)
const tar_buffer = Buffer.from(base64, 'base64')

const outpath = path.join(assetDir, "archive")
Expand Down
18 changes: 18 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,28 @@ module.exports = {
// Include the vue compiler so mods can use templates
"vue$": "vue/dist/vue.esm.js"
}
},
module: {
rules: [
{
test: /\.node$/,
loader: "node-loader",
}
]
}
},
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
// TEMPORARY: builds failing due to faulty minimization!
chainWebpackMainProcess: config => {
config.plugins.delete("uglify");
config.optimization.minimize(false);
},
// chainWebpackRendererProcess: config => {
// config.plugins.delete("uglify");
// config.optimization.minimize(false);
// },
builderOptions: {
appId: "com.bambosh.unofficialhomestuckcollection",
productName: "The Unofficial Homestuck Collection",
Expand All @@ -26,6 +43,7 @@ module.exports = {
"ia32"
]
},
artifactName: "${productName}-${version}-${os}-${arch}.${ext}",
asarUnpack: [
"**/node_modules/sharp/**"
]
Expand Down
Loading

0 comments on commit cd16bb0

Please sign in to comment.