Skip to content

Commit

Permalink
Build and package ARM releases
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
ab77 committed Nov 11, 2022
1 parent 7de9900 commit 5420891
Show file tree
Hide file tree
Showing 7 changed files with 600 additions and 805 deletions.
2 changes: 1 addition & 1 deletion .github/actions/always/action.yml
Expand Up @@ -26,7 +26,7 @@ runs:
github.event.pull_request.merged == false &&
github.event.action == 'closed'
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand Down
9 changes: 7 additions & 2 deletions .github/actions/finalize/action.yml
Expand Up @@ -9,14 +9,19 @@ inputs:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true

# --- custom environment
VERBOSE:
type: string
default: "true"

runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Get release version
if: runner.os == 'Linux'
id: get_release
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand All @@ -27,7 +32,7 @@ runs:
# https://docs.github.com/en/rest/releases
- name: Finalize GitHub release
if: runner.os == 'Linux'
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand Down
37 changes: 19 additions & 18 deletions .github/actions/publish/action.yml
Expand Up @@ -42,7 +42,7 @@ runs:
cache: npm

- name: Install yq
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: choco install yq
if: runner.os == 'Windows'

Expand All @@ -56,7 +56,7 @@ runs:
path: resinci-deploy

- name: Build and install resinci-deploy
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand All @@ -78,7 +78,7 @@ runs:
# https://docs.sentry.io/api/projects/create-a-new-client-key/
- name: Generate Sentry DSN
id: sentry
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand Down Expand Up @@ -126,51 +126,49 @@ runs:
WINDOWS_CERTIFICATE: ${{ fromJSON(inputs.secrets).WINDOWS_SIGNING }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ fromJSON(inputs.secrets).WINDOWS_SIGNING_PASSWORD }}

# ... or refactor (e.g.) https://github.com/samuelmeuli/action-electron-builder
# https://github.com/product-os/scripts/tree/master/electron
# https://github.com/product-os/scripts/tree/master/shared
# https://github.com/product-os/balena-concourse/blob/master/pipelines/github-events/template.yml
- name: Package release
id: package_release
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
runner_arch="$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')"
ELECTRON_BUILDER_ARCHITECTURE="${runner_arch}"
APPLICATION_VERSION="$(jq -r '.version' package.json)"
ARCHITECTURE_FLAGS="--${ELECTRON_BUILDER_ARCHITECTURE}"
if [[ $runner_os =~ linux ]]; then
ELECTRON_BUILDER_OS='--linux'
TARGETS="$(yq e .linux.target[] electron-builder.yml)"
ELECTRON_BUILDER_OS=linux
elif [[ $runner_os =~ darwin|macos|osx ]]; then
CSC_KEY_PASSWORD=${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
CSC_KEYCHAIN=signing_temp
CSC_LINK=${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
ELECTRON_BUILDER_OS='--mac'
TARGETS="$(yq e .mac.target[] electron-builder.yml)"
ELECTRON_BUILDER_OS=mac
elif [[ $runner_os =~ windows|win ]]; then
ARCHITECTURE_FLAGS="--ia32 ${ARCHITECTURE_FLAGS}"
CSC_KEY_PASSWORD=${{ fromJSON(inputs.secrets).WINDOWS_SIGNING_PASSWORD }}
CSC_LINK=${{ fromJSON(inputs.secrets).WINDOWS_SIGNING }}
ELECTRON_BUILDER_OS='--win'
TARGETS="$(yq e .win.target[] electron-builder.yml)"
ELECTRON_BUILDER_OS=win
else
exit 1
false
fi
TARGETS="$(yq e '.build.[env(ELECTRON_BUILDER_OS)].target[].target' package.json)"
npm link electron-builder
for target in ${TARGETS}; do
electron-builder ${ELECTRON_BUILDER_OS} ${target} ${ARCHITECTURE_FLAGS} \
archs="$(yq e '.build.[env(ELECTRON_BUILDER_OS)].target[] | select(.target == env(target)).arch[]' package.json)"
archs=(${archs})
arch_flags=$(for arch in ${archs[*]}; do echo "--${arch}"; done | tr '\n' ' ')
electron-builder "--${ELECTRON_BUILDER_OS}" ${target} ${arch_flags} \
--c.extraMetadata.analytics.sentry.token='${{ steps.sentry.outputs.dsn }}' \
--c.extraMetadata.packageType="${target}"
Expand All @@ -186,10 +184,13 @@ runs:
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/#improvements-for-public-repository-forks
# https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks#about-workflow-runs-from-public-forks
CSC_FOR_PULL_REQUEST: true
# https://www.electron.build/#debug
FPM_DEBUG: 1
DEBUG: electron-builder

# https://www.electron.build/auto-update.html#staged-rollouts
- name: Configure staged rollout(s)
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/test/action.yml
Expand Up @@ -23,7 +23,7 @@ runs:
steps:
- name: Delete previous draft release
if: runner.os == 'Linux'
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand All @@ -42,7 +42,7 @@ runs:
cache: npm

- name: Test release
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
Expand Down
109 changes: 0 additions & 109 deletions electron-builder.yml

This file was deleted.

0 comments on commit 5420891

Please sign in to comment.