Skip to content

Commit

Permalink
chore: simplify CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed Sep 23, 2024
1 parent f3cf19d commit 537a399
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 136 deletions.
60 changes: 18 additions & 42 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This script will build session production binaries anytime a branch is updated
name: Session Build Binaries
name: Session Desktop

on:
push:
Expand Down Expand Up @@ -40,45 +39,22 @@ jobs:
- name: Setup & Build
uses: ./actions/setup_and_build

- name: Enforce yarn.lock has no duplicates
uses: ./actions/deduplicate_fail

- name: Build windows production binaries
if: runner.os == 'Windows'
run: node_modules\.bin\electron-builder --config.extraMetadata.environment=%SIGNAL_ENV% --publish=never --config.directories.output=release

- name: Build mac production binaries
if: runner.os == 'macOS'
run: |
source ./build/setup-mac-certificate.sh
$(yarn bin)/electron-builder --config.extraMetadata.environment=$SIGNAL_ENV --config.mac.bundleVersion=${{ github.ref }} --publish=never --config.directories.output=release
env:
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}

- name: Build linux production binaries
- name: Lint Files
# no need to lint files on all platforms. Just do it once on the quicker one
if: runner.os == 'Linux'
run: |
sudo apt-get install -y rpm
yarn build-release
run: yarn lint-full

- name: Remove unpacked files
run: |
ls -d -- */ | xargs -I{} echo "Removing {}"
ls -d -- */ | xargs -I{} rm -rf {}
shell: bash
working-directory: ./release/

- name: Remaining files
run: ls .
shell: bash
working-directory: ./release/

- name: Upload Production Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ runner.arch }}-production
path: release
- name: Enforce yarn.lock has no duplicates
uses: ./actions/deduplicate_fail
- name: Unit Test
run: yarn test

- name: Build but do not publish
# we want this to run always, except on "push" to "master"
if: github.event_name != 'push' || github.ref != 'master'
uses: ./actions/build_no_publish

- name: Build & publish
# we want this to run only when on "push" to "master"
if: github.event_name == 'push' && github.ref == 'master'
uses: ./actions/build_publish
46 changes: 0 additions & 46 deletions .github/workflows/pull-request.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/release.yml

This file was deleted.

47 changes: 47 additions & 0 deletions actions/build_no_publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Build Only (no publish)'
description: 'Build only (no publish)'
runs:
using: 'composite'
steps:
- name: Build windows production binaries
shell: bash
if: runner.os == 'Windows'
run: $(yarn bin)/electron-builder --config.extraMetadata.environment=%SIGNAL_ENV% --publish=never --config.directories.output=release

- name: Build mac production binaries
shell: bash
if: runner.os == 'macOS'
run: |
source ./build/setup-mac-certificate.sh
$(yarn bin)/electron-builder --config.extraMetadata.environment=$SIGNAL_ENV --config.mac.bundleVersion=${{ github.ref }} --publish=never --config.directories.output=release
env:
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}

- name: Build linux production binaries
shell: bash
if: runner.os == 'Linux'
run: |
sudo apt-get install -y rpm
yarn build-release
- name: Remove unpacked files
run: |
ls -d -- */ | xargs -I{} echo "Removing {}"
ls -d -- */ | xargs -I{} rm -rf {}
shell: bash
working-directory: ./release/

- name: Remaining files
run: ls .
shell: bash
working-directory: ./release/

- name: Upload Production Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ runner.arch }}-production
path: release
29 changes: 29 additions & 0 deletions actions/build_publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Build & Publish'
description: 'Build & Publish'
runs:
using: 'composite'
steps:
- name: Build & publish windows production binaries
shell: bash
if: runner.os == 'Windows' && github.ref == 'master' && github.event_name == 'push'
run: $(yarn bin)/electron-builder --config.extraMetadata.environment=%SIGNAL_ENV% --publish=always

- name: Build & publish mac production binaries
shell: bash
if: runner.os == 'macOS' && github.ref == 'master' && github.event_name == 'push'
run: |
source ./build/setup-mac-certificate.sh
$(yarn bin)/electron-builder --config.extraMetadata.environment=$SIGNAL_ENV --config.mac.bundleVersion=${{ github.ref }} --publish=always
env:
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}

- name: Build & publish linux production binaries
shell: bash
if: runner.os == 'Linux' && github.ref == 'master' && github.event_name == 'push'
run: |
sudo apt-get install -y rpm
yarn build-release-publish

0 comments on commit 537a399

Please sign in to comment.