Skip to content

Publish release

Publish release #124

Workflow file for this run

name: Publish release
on:
release: ~
workflow_dispatch: ~
env:
DEBUG: 'electron-installer-snap*'
jobs:
build:
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, windows-latest, macos-13, macos-14]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
# Follow https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
# to sign the application.
# You can create:
# The "Developer ID Application" certificate here: https://developer.apple.com/account/resources/certificates/list
# The provision profile and certificate here: https://developer.apple.com/account/resources/profiles/list
- name: Install the Apple certificate and provisioning profile
if: startsWith(matrix.os, 'macos')
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.APPLE_BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: 'electron packager: do not be quiet !' # See https://github.com/electron/forge/issues/3540
run: mv node_modules/@electron-forge/core/dist/api/package.js node_modules/@electron-forge/core/dist/api/package.quiet.js && sed 's/packageOpts.quiet = true/packageOpts.quiet = false/' node_modules/@electron-forge/core/dist/api/package.quiet.js > node_modules/@electron-forge/core/dist/api/package.js
# Issue with max opened file on arm macos
- name: 'change ulimit for arm macos'
if: startsWith(matrix.os, 'macos-14')
run: ulimit -n 999999
# Issue with max opened file on arm macos
- name: 'change launchctl limit for arm macos'
if: startsWith(matrix.os, 'macos-14')
run: sudo launchctl limit maxfiles 999999 999999
# snapcraft specific
- name: Setup LXD
uses: canonical/setup-lxd@main
if: startsWith(matrix.os, 'ubuntu')
- name: Install snapcraft for linux
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install snapcraft snapd
- name: install weird snapcraft dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo snap install gnome-42-2204 gnome-42-2204-sdk gtk-common-themes
- name: do not use "snapcraft.cfg" file
# run: sed -i 's/if (!(await fs.pathExists(snapcraftCfgPath)))/if (false \&\& !(await fs.pathExists(snapcraftCfgPath)))/' node_modules/@electron-forge/publisher-snapcraft/src/PublisherSnapcraft.ts
run: sed -i 's/if (!(await fs_extra_1.default.pathExists(snapcraftCfgPath)))/if (false \&\& !(await fs_extra_1.default.pathExists(snapcraftCfgPath)))/' node_modules/@electron-forge/publisher-snapcraft/dist/PublisherSnapcraft.js
- name: fix issue with Snapcraft path
# run: sed -i 's/if (!(await fs.pathExists(snapcraftCfgPath)))/if (false \&\& !(await fs.pathExists(snapcraftCfgPath)))/' node_modules/@electron-forge/publisher-snapcraft/src/PublisherSnapcraft.ts
run: sed -i 's/snapcraft = new Snapcraft();/snapcraft = new Snapcraft();await snapcraft.ensureInstalled();/' node_modules/@electron-forge/publisher-snapcraft/dist/PublisherSnapcraft.js
- name: fix issue with Snapcraft files
run: sed -i "s/snapcraft.run(dir, 'push', this.config, snapArtifacts)/snapcraft.run(dir, 'push' . snapArtifacts.join(' '), this.config)/" node_modules/@electron-forge/publisher-snapcraft/dist/PublisherSnapcraft.js
# end snapcraft specific
- name: Sign & Publish Electron app
run: yarn publish
env:
# MacOS sign specific
APPLE_SIGN_ID: ${{ secrets.APPLE_SIGN_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# for snapcraft
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
# For every platform
GITHUB_TOKEN: ${{ github.token }}