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 Dec 5, 2022
1 parent 14aeb00 commit 27f9cdc
Show file tree
Hide file tree
Showing 4 changed files with 592 additions and 802 deletions.
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.analytics.mixpanel.token='balena-etcher' \
--c.extraMetadata.packageType="${target}"
Expand All @@ -187,10 +185,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
109 changes: 0 additions & 109 deletions electron-builder.yml

This file was deleted.

0 comments on commit 27f9cdc

Please sign in to comment.