Skip to content

Commit

Permalink
ci: github publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
MrL0co committed Oct 16, 2022
1 parent 867f0cf commit d4e9ebb
Show file tree
Hide file tree
Showing 6 changed files with 399 additions and 45 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Build & Release

on:
push:
branches:
- main
tags:
- v*
pull_request:

jobs:
test:
name: Test (${{ matrix.os }} - ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macOS-latest, ubuntu-latest, windows-latest ]
arch: [ x64 ]
include:
- os: macOS-latest
arch: arm64
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3.5.0
with:
node-version: 16.x
cache: yarn
- name: Install
run: yarn --frozen-lockfile --network-timeout 100000 || yarn --frozen-lockfile --network-timeout 100000 || yarn --frozen-lockfile --network-timeout 100000
- name: Create fake contributors
uses: 1arp/create-a-file-action@0.2
with:
path: 'static'
file: 'contributors.json'
content: "[]"
# - name: lint
# run: yarn lint
# - name: test
# run: yarn test:ci
# - name: Coveralls
# if: matrix.os == 'ubuntu-latest'
# uses: coverallsapp/github-action@1.1.3
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: test
name: Build (${{ matrix.os }} - ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Build for supported platforms
# https://github.com/electron/electron-packager/blob/ebcbd439ff3e0f6f92fa880ff28a8670a9bcf2ab/src/targets.js#L9
# 32-bit Linux unsupported as of 2019: https://www.electronjs.org/blog/linux-32bit-support
os: [ macOS-latest, ubuntu-latest, windows-latest ]
arch: [ x64, arm64 ]
include:
- os: windows-latest
arch: ia32
- os: ubuntu-latest
arch: armv7l
# Publishing artifacts for multiple Windows architectures has
# a bug which can cause the wrong architecture to be downloaded
# for an update, so until that is fixed, only build Windows x64
exclude:
- os: windows-latest
arch: arm64

steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3.5.0
with:
node-version: 16.x
cache: yarn
# - name: Set MacOS signing certs
# if: matrix.os == 'macOS-latest'
# run: chmod +x tools/add-macos-cert.sh && ./tools/add-macos-cert.sh
# env:
# MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
# MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
# - name: Set Windows signing certificate
# if: matrix.os == 'windows-latest'
# continue-on-error: true
# id: write_file
# uses: timheuer/base64-to-file@v1
# with:
# fileName: 'win-certificate.pfx'
# encodedString: ${{ secrets.WINDOWS_CODESIGN_P12 }}
- name: Install
run: yarn --network-timeout 100000 || yarn --network-timeout 100000 || yarn --network-timeout 100000
- name: Make
if: startsWith(github.ref, 'refs/tags/')
run: yarn make --arch=${{ matrix.arch }}
env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# WINDOWS_CODESIGN_FILE: ${{ steps.write_file.outputs.filePath }}
# WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
# - name: Archive production artifacts
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.os }}
# path: out/make/**/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
files: |
out/**/*.deb
out/**/*.dmg
out/**/*setup*.exe
out/**/*.nupkg
out/**/*.rpm
out/**/*.zip
out/**/RELEASES
out/**/*portable*.exe
75 changes: 75 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
const path = require('path');

const packageJson = require('./package.json');

const {version} = packageJson;
const iconDir = path.resolve(__dirname, 'icons');

const config = {
packagerConfig: {
name: "Zpl Printer",
executableName: 'zpl-printer',
icon: path.resolve(__dirname, 'icons', 'icon'),
},
makers: [
{
name: "@rabbitholesyndrome/electron-forge-maker-portable",
platforms: ['win32'],
config: {
portable: {
artifactName: "${name}-portable-${version}.exe"
}
}
},
{
name: "@electron-forge/maker-squirrel",
platforms: ['win32'],
config: (arch) => ({
name: "zpl-printer",
exe: 'zpl-printer.exe',
iconUrl: "https://github.com/MrL0co/ZplPrinter/blob/electron/icons/icon.ico?raw=true",
noMsi: true,
setupExe: `zpl-printer-${version}-win32-${arch}-setup.exe`,
setupIcon: path.resolve(iconDir, "icon.ico"),
})
},
{
name: "@electron-forge/maker-zip",
platforms: [
"darwin",
"linux"
]
},
{
name: "@electron-forge/maker-deb",
config: {
icon: {
scalable: path.resolve(iconDir, 'icon.svg')
}
}
},
{
name: "@electron-forge/maker-rpm",
config: {
icon: {
scalable: path.resolve(iconDir, 'icon.svg')
}
}
}
],
publishers: [
{
name: "@electron-forge/publisher-github",
config: {
repository: {
owner: "MrL0co",
name: "ZplPrinter"
},
prerelease: false,
draft: true
}
}
]
};

module.exports = config;
16 changes: 16 additions & 0 deletions icons/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('update-electron-app')()

const { app, BrowserWindow } = require('electron')

if (require('electron-squirrel-startup')) return app.quit();
Expand Down
51 changes: 7 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "zplprinter",
"name": "zpl-printer",
"productName": "Zpl Printer",
"version": "1.0.0",
"description": "Printer emulator for zpl rendering engine.",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
"make": "electron-forge make",
"publish": "electron-forge publish"
},
"repository": {
"type": "git",
Expand All @@ -25,54 +27,15 @@
"@electron-forge/maker-rpm": "^6.0.0-beta.67",
"@electron-forge/maker-squirrel": "^6.0.0-beta.67",
"@electron-forge/maker-zip": "^6.0.0-beta.67",
"@electron-forge/publisher-github": "^6.0.0-beta.67",
"@rabbitholesyndrome/electron-forge-maker-portable": "^0.1.1",
"electron": "^21.1.0"
},
"dependencies": {
"bootstrap": "3.3.1",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^8.1.0",
"jquery": "^3.6.1"
},
"config": {
"forge": {
"packagerConfig": {
"name": "Zpl Printer",
"icon": "./icons/icon"
},
"makers": [
{
"name": "@rabbitholesyndrome/electron-forge-maker-portable",
"config": {}
},
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "ZplPrinter",
"iconUrl": "https://github.com/MrL0co/ZplPrinter/blob/electron/icons/icon.ico?raw=true",
"setupIcon": "./icons/icon.ico"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin",
"linux"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {
"options": {
"icon": "./icons/png/512x512.png"
}
}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
"jquery": "^3.6.1",
"update-electron-app": "^2.0.1"
}
}
Loading

0 comments on commit d4e9ebb

Please sign in to comment.