Skip to content

Commit

Permalink
build: use new way to build/release (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-alarcon authored Sep 18, 2023
1 parent 2c6c818 commit 1f37b1f
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 38 deletions.
67 changes: 50 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build/release

on: [push, pull_request]
on: [push]

env:
GH_TOKEN: ${{ SECRETS.GITHUB_TOKEN }}

jobs:
release:
Expand All @@ -10,6 +13,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x64, arm64, arm]
exclude:
- os: macos-latest
arch: arm
- os: macos-latest
arch: x64
- os: windows-latest
arch: arm
- os: windows-latest
arch: arm64

steps:
- name: Check out Git repository
Expand All @@ -20,25 +33,45 @@ jobs:
with:
node-version: 20

- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
# Only install Snapcraft on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
with:
# Log in to Snap Store
snapcraft_token: ${{ secrets.snapcraft_token }}
- name: Build
run: yarn --link-duplicates --pure-lockfile

- name: Install libarchive-tools for pacman build # Related https://github.com/electron-userland/electron-builder/issues/4181
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install libarchive-tools

- name: Build/release Electron app
uses: coparse-inc/[email protected]
with:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.github_token }}
- name: Build for test only linux
if: |
github.ref != 'main' &&
startsWith(matrix.os, 'ubuntu')
run: yarn dist:linux:${{ matrix.arch }} -- --publish never

- name: Release linux
if: |
github.ref == 'main' &&
startsWith(matrix.os, 'ubuntu')
run: yarn dist:linux:${{ matrix.arch }} -- --publish always

- name: Build for test only macos
if: |
github.ref != 'main' &&
startsWith(matrix.os, 'macos')
run: yarn dist:mac -- --publish never

- name: Release macos
if: |
github.ref == 'main' &&
startsWith(matrix.os, 'macos')
run: yarn dist:mac -- --publish always

- name: Build for test only windows
if: |
github.ref != 'main' &&
startsWith(matrix.os, 'windows')
run: yarn dist:windows -- --publish never

# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Release windows
if: |
github.ref == 'main' &&
startsWith(matrix.os, 'windows')
run: yarn dist:windows -- --publish always
67 changes: 67 additions & 0 deletions .github/workflows/snap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build/release for Snap

on: push

defaults:
run:
shell: bash

jobs:

snap:
runs-on: ubuntu-latest

env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 20

- name: Build
run: yarn --link-duplicates --pure-lockfile

- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2

- name: Build for test only
if: github.ref != 'main'
run: yarn dist:linux:snap --publish never

- name: Release
if: github.ref == 'main'
run: yarn dist:linux:snap --publish always

snap-armv7l:
runs-on: ubuntu-latest

env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 20

- name: Build
run: yarn --link-duplicates --pure-lockfile

- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2

- name: Build for test only
if: github.ref != 'main'
run: yarn dist:linux:snap:armv7l --publish never

- name: Release
if: github.ref == 'main'
run: yarn dist:linux:snap:armv7l --publish always
47 changes: 26 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "prospect-mail",
"productName": "Prospect Mail",
"version": "0.5.0-beta2",
"version": "0.5.0-beta1",
"main": "src/main.js",
"description": "Unofficial desktop client for Microsoft Outlook",
"homepage": "https://github.com/julian-alarcon/prospect-mail",
Expand Down Expand Up @@ -33,16 +33,22 @@
"start": "electron .",
"start-minimized": "electron . --minimized",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"dist:linux": "electron-builder --linux",
"dist:linux:appimage": "electron-builder --linux AppImage",
"dist:linux:deb": "electron-builder --linux deb",
"dist:linux:snap": "electron-builder --linux snap",
"dist:linux:pacman": "electron-builder --linux pacman",
"dist:linux:appimage": "electron-builder --x64 --armv7l --arm64 -l AppImage",
"dist:linux:deb": "electron-builder --x64 --armv7l --arm64 -l deb",
"dist:linux:pacman": "electron-builder --l pacman",
"dist:linux:rpm": "electron-builder --x64 --armv7l --arm64 -l rpm",
"dist:linux:snap": "electron-builder -l snap",
"dist:linux:snap:armv7l": "electron-builder --armv7l -l snap",
"dist:linux:targz": "electron-builder --x64 --armv7l --arm64 -l tar.gz",
"dist:mac": "electron-builder --mac",
"dist:win": "electron-builder --win",
"postinstall": "electron-builder install-app-deps",
"publish": "build -p always",
"release": "electron-builder"
"dist:windows": "electron-builder --windows --x64",
"dist:linux:x64": "electron-builder --x64 -l AppImage deb pacman rpm tar.gz",
"dist:linux:arm64": "electron-builder --arm64 -l AppImage deb pacman rpm tar.gz",
"dist:linux:arm": "electron-builder --armv7l -l AppImage deb pacman rpm tar.gz",
"release": "electron-builder",
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"about-window": "^1.15.2",
Expand All @@ -56,7 +62,7 @@
"build": {
"appId": "io.github.julian-alarcon.prospect-mail",
"linux": {
"category": "Mail;Network;Office",
"category": "Email;Network;Office",
"packageCategory": "net",
"executableName": "prospect-mail",
"synopsis": "Prospect Mail",
Expand All @@ -66,25 +72,27 @@
"StartupWMClass": "prospect-mail"
},
"target": [
"rpm",
"deb",
"tar.gz",
"AppImage",
"snap"
"deb",
"pacman",
"rpm",
"snap",
"tar.gz"
],
"publish": {
"provider": "github",
"releaseType": "draft"
}
},
"rpm": {
"fpm": [
"--rpm-rpmbuild-define=_build_id_links none"
]
},
"snap": {
"summary": "Prospect Mail",
"confinement": "strict",
"grade": "stable",
"buildPackages": [],
"stagePackages": [
"default"
],
"base": "core22",
"plugs": [
"default",
Expand All @@ -102,9 +110,6 @@
},
"mac": {
"category": "public.app-category.productivity",
"target": [
"dmg"
],
"icon": "build/icon.icns",
"type": "distribution",
"publish": {
Expand Down

0 comments on commit 1f37b1f

Please sign in to comment.