mirror of
https://github.com/ivabus/gui
synced 2025-04-24 06:27:09 +03:00
#186 update ci/cd pipeline to build electron
This commit is contained in:
parent
e61c09b585
commit
0be8a6db2d
2 changed files with 141 additions and 140 deletions
129
.github/workflows/main.yml
vendored
129
.github/workflows/main.yml
vendored
|
@ -9,92 +9,78 @@ jobs:
|
|||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
svelte: ${{steps.svelte.outputs.src}}
|
||||
tauri: ${{steps.tauri.outputs.src}}
|
||||
desktop: ${{steps.desktop.outputs.src}}
|
||||
preview_folder: ${{steps.preview.outputs.folder}}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: svelte
|
||||
id: desktop
|
||||
with:
|
||||
filters: |
|
||||
src:
|
||||
- 'modules/gui/src/**'
|
||||
- 'modules/desktop/**'
|
||||
- 'modules/ui/**'
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: tauri
|
||||
with:
|
||||
filters: |
|
||||
src:
|
||||
- 'modules/gui/src-tauri/**'
|
||||
- 'modules/gui/src/**'
|
||||
- 'modules/ui/src/**'
|
||||
build_svelte:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.svelte == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: cache gui linux
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
key: linux+x86-64-20-pnpm-cargo-main
|
||||
path: |
|
||||
./pnpm
|
||||
./target
|
||||
- name: build tauri for Linux
|
||||
if: startsWith(matrix.platform.name, 'linux')
|
||||
uses: docker://getneil/tea-builder:latest
|
||||
- name: get s3 preview folder
|
||||
id: preview
|
||||
run: echo "folder=${{ github.event.number }}-merge" >> $GITHUB_OUTPUT
|
||||
|
||||
build_tauri:
|
||||
build_desktop:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.tauri == 'true'
|
||||
if: needs.changes.outputs.desktop == 'true'
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- os: macos-11
|
||||
name: darwin+x86-64
|
||||
- os: ubuntu-latest
|
||||
name: linux+x86-64
|
||||
# TODO: #181 build for linux
|
||||
# - os: ubuntu-latest
|
||||
# name: linux+x86-64
|
||||
- os: [self-hosted, macOS, ARM64]
|
||||
name: darwin+aarch64
|
||||
# err: Package atk was not found in the pkg-config search path.
|
||||
# requires atk >= 2.18
|
||||
# - os: [self-hosted, linux, ARM64]
|
||||
# name: linux+aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: teaxyz/setup@v0
|
||||
if: startsWith(matrix.platform.name, 'darwin')
|
||||
- name: cache gui build
|
||||
- name: cache node_modules build
|
||||
# TODO: cache issue in our self-hosted macos runner ESPIPE: invalid seek, read
|
||||
# but its ok to ignore, its still the fastest builder
|
||||
# NOTE: enabling cache in the self hosted runner slows down the pipeline by 4m because post-cache builder error ^
|
||||
if: startsWith(matrix.platform.name, 'linux') || matrix.platform.name == 'darwin+x86-64'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
key: ${{matrix.platform.name}}-pnpm-cargo-main
|
||||
key: ${{matrix.platform.name}}-pnpm-prod
|
||||
path: |
|
||||
./pnpm
|
||||
./target
|
||||
- name: build tauri for MacOS
|
||||
./.pnpm-store
|
||||
./node_modules
|
||||
./modules/desktop/node_modules
|
||||
./modules/ui/node_modules
|
||||
- name: cache electron build
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
key: ${{matrix.platform.name}}-electron-prod
|
||||
path: |
|
||||
./modules/desktop/.svelte-kit
|
||||
./modules/desktop/build
|
||||
./modules/desktop/dist
|
||||
|
||||
- name: build
|
||||
if: startsWith(matrix.platform.name, 'darwin')
|
||||
run: tea -ES xc build
|
||||
run: tea -ES xc dist
|
||||
env:
|
||||
CARGO_TARGET_DIR: ${{ github.workspace }}/target
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
|
||||
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||
|
||||
- name: build tauri for Linux
|
||||
if: startsWith(matrix.platform.name, 'linux')
|
||||
# TODO: https://tauri.app/v1/guides/distribution/sign-linux
|
||||
uses: ./devops/linux-builder
|
||||
|
||||
- run: tar -czvf artifacts.tgz -C ./target/release/bundle .
|
||||
|
||||
USE_HARD_LINKS: false
|
||||
CSC_LINK: ${{ secrets.GUI_APPLE_CERTIFICATE }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
|
||||
CSC_NAME: ${{ secrets.APPLE_IDENTITY_NO_PREFIX }}
|
||||
# APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
# APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
- run: mkdir -p target
|
||||
- run: cp ./modules/desktop/dist/*.zip ./target/tea.zip
|
||||
- run: tar -czvf artifacts.tgz -C ./target/ .
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
@ -102,8 +88,8 @@ jobs:
|
|||
path: artifacts.tgz
|
||||
if-no-files-found: error
|
||||
|
||||
notorize_tauri:
|
||||
needs: [build_tauri]
|
||||
notarize_desktop:
|
||||
needs: [build_desktop]
|
||||
runs-on: macos-11
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -126,13 +112,13 @@ jobs:
|
|||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
|
||||
upload:
|
||||
needs: [build_tauri, notorize_tauri]
|
||||
needs: [build_desktop, notarize_desktop]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- darwin+x86-64
|
||||
- linux+x86-64
|
||||
# - linux+x86-64
|
||||
- darwin+aarch64
|
||||
# - linux+aarch64
|
||||
steps:
|
||||
|
@ -171,11 +157,11 @@ jobs:
|
|||
;;
|
||||
"darwin+aarch64")
|
||||
BUILD_PLATFORM="aarch64"
|
||||
EXTENSION="dmg"
|
||||
EXTENSION="zip"
|
||||
;;
|
||||
"darwin+x86-64")
|
||||
BUILD_PLATFORM="x64"
|
||||
EXTENSION="dmg"
|
||||
EXTENSION="zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown platform $platform"
|
||||
|
@ -185,12 +171,6 @@ jobs:
|
|||
echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
|
||||
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: zip .app for MacOS
|
||||
if: startsWith(matrix.platform, 'darwin+')
|
||||
run: |
|
||||
cd ./macos/
|
||||
zip -r tea.zip tea.app
|
||||
|
||||
- name: cp package images from prod to gui bucket
|
||||
env:
|
||||
platform: ${{ steps.build_platform.outputs.build_platform }}
|
||||
|
@ -198,20 +178,22 @@ jobs:
|
|||
extension: ${{steps.build_platform.outputs.extension}}
|
||||
run: |
|
||||
aws s3 cp \
|
||||
"./$extension/tea_0.1.0_$platform.$extension" \
|
||||
"./tea.$extension" \
|
||||
"s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.$extension"
|
||||
|
||||
- name: cp package zip for MacOS
|
||||
if: startsWith(matrix.platform, 'darwin')
|
||||
env:
|
||||
platform: ${{ steps.build_platform.outputs.build_platform }}
|
||||
build_platform: ${{ matrix.platform }}
|
||||
extension: ${{ steps.build_platform.outputs.extension }}
|
||||
run: |
|
||||
aws s3 cp ./macos/tea.zip \
|
||||
"s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.zip"
|
||||
"s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.$extension"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Slack Notification
|
||||
run: ./.github/notify-slack.js
|
||||
env:
|
||||
|
@ -219,12 +201,3 @@ jobs:
|
|||
PLATFORM: ${{ matrix.platform }}
|
||||
EXT: ${{ steps.build_platform.outputs.extension }}
|
||||
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_${{ steps.date.outputs.unix_seconds }}_${{ steps.build_platform.outputs.build_platform }}.${{ steps.build_platform.outputs.extension }}
|
||||
|
||||
- name: Slack Notification for .app Mac
|
||||
run: ./.github/notify-slack.js
|
||||
if: startsWith(matrix.platform, 'darwin')
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
EXT: .zip(.app)
|
||||
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_${{ steps.date.outputs.unix_seconds }}_${{ steps.build_platform.outputs.build_platform }}.zip
|
||||
|
|
152
.github/workflows/release.yml
vendored
152
.github/workflows/release.yml
vendored
|
@ -4,15 +4,15 @@ on:
|
|||
- 'v*.*.*'
|
||||
|
||||
jobs:
|
||||
build_release_tauri:
|
||||
build_desktop:
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- os: macos-11
|
||||
name: darwin+x86-64
|
||||
- os: ubuntu-latest
|
||||
name: linux+x86-64
|
||||
# - os: ubuntu-latest
|
||||
# name: linux+x86-64
|
||||
- os: [self-hosted, macOS, ARM64]
|
||||
name: darwin+aarch64
|
||||
# - os: [self-hosted, linux, ARM64]
|
||||
|
@ -20,45 +20,99 @@ jobs:
|
|||
container: ${{ matrix.platform.container }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: build platform output
|
||||
id: build_platform
|
||||
env:
|
||||
platform: ${{ matrix.platform.name }}
|
||||
run: |
|
||||
EXTENSION=dmg
|
||||
BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g")
|
||||
[[ $BUILD_PLATFORM = "x86-64" ]] && BUILD_PLATFORM="x64" || BUILD_PLATFORM=$BUILD_PLATFORM
|
||||
[[ $platform = "linux+x86-64" ]] && BUILD_PLATFORM="amd64" || BUILD_PLATFORM=$BUILD_PLATFORM
|
||||
[[ $platform = "linux+x86-64" ]] && EXTENSION="deb"
|
||||
echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
|
||||
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: build tauri for MacOS
|
||||
- uses: teaxyz/setup@v0
|
||||
- name: build
|
||||
if: startsWith(matrix.platform.name, 'darwin')
|
||||
# FROM: https://tauri.app/v1/guides/distribution/sign-macos
|
||||
run: tea -ES xc dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
|
||||
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||
# todo: uncomment when m1 with latest xcode is deployed
|
||||
# this only helps in notarization
|
||||
# APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
run: |
|
||||
sh <(curl https://tea.xyz) -ES xc build
|
||||
USE_HARD_LINKS: false
|
||||
CSC_LINK: ${{ secrets.GUI_APPLE_CERTIFICATE }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
|
||||
CSC_NAME: ${{ secrets.APPLE_IDENTITY_NO_PREFIX }}
|
||||
- run: mkdir -p target
|
||||
- run: cp ./modules/desktop/dist/*.zip ./target/tea.zip
|
||||
- run: tar -czvf artifacts.tgz -C ./target/ .
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform.name }}
|
||||
path: artifacts.tgz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: build tauri for Linux
|
||||
# uses: teaxyz/setup@v0
|
||||
if: startsWith(matrix.platform.name, 'linux')
|
||||
# TODO: https://tauri.app/v1/guides/distribution/sign-linux
|
||||
uses: docker://getneil/tea-builder:latest
|
||||
notarize_desktop:
|
||||
needs: [build_desktop]
|
||||
runs-on: macos-11
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- darwin+x86-64
|
||||
- darwin+aarch64
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform }}
|
||||
|
||||
- run: tar xzf artifacts.tgz
|
||||
|
||||
- run: cd ./macos/ && zip -r tea.zip tea.app
|
||||
|
||||
# Notarize. Can take up to 10 minutes (and fail) asynchronously
|
||||
- run: xcrun altool --notarize-app --username "$APPLE_ID" --password "$APPLE_PASSWORD" --primary-bundle-id "com.tea.xyz" --file ./macos/tea.zip
|
||||
env:
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
|
||||
upload:
|
||||
needs: [build_desktop, notarize_desktop]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- darwin+x86-64
|
||||
# - linux+x86-64
|
||||
- darwin+aarch64
|
||||
# - linux+aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform }}
|
||||
- name: Get current unix ts - seconds
|
||||
id: date
|
||||
run: echo "unix_seconds=$(date +'%s')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: build platform output
|
||||
id: build_platform
|
||||
env:
|
||||
platform: ${{ matrix.platform }}
|
||||
run: |
|
||||
BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g")
|
||||
EXTENSION=dmg
|
||||
case $platform in
|
||||
"linux+x86-64")
|
||||
BUILD_PLATFORM="amd64"
|
||||
EXTENSION="deb"
|
||||
;;
|
||||
"linux+aarch64")
|
||||
BUILD_PLATFORM="aarch64"
|
||||
EXTENSION="deb"
|
||||
;;
|
||||
"darwin+aarch64")
|
||||
BUILD_PLATFORM="aarch64"
|
||||
EXTENSION="zip"
|
||||
;;
|
||||
"darwin+x86-64")
|
||||
BUILD_PLATFORM="x64"
|
||||
EXTENSION="zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown platform $platform"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
|
||||
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
|
@ -76,27 +130,11 @@ jobs:
|
|||
extension: ${{ steps.build_platform.outputs.extension }}
|
||||
tag: ${{ steps.tag.outputs.tag }}
|
||||
run: |
|
||||
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/$extension/tea_0.1.0_$platform.$extension" \
|
||||
aws s3 cp "./tea.$extension" \
|
||||
"s3://preview.gui.tea.xyz/release/tea_gui_latest_$platform.$extension"
|
||||
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/$extension/tea_0.1.0_$platform.$extension" \
|
||||
aws s3 cp "./tea.$extension" \
|
||||
"s3://preview.gui.tea.xyz/release/tea_gui_${{ steps.tag.outputs.tag }}_$platform.$extension"
|
||||
|
||||
- name: zip .app for MacOS
|
||||
if: startsWith(matrix.platform.name, 'darwin')
|
||||
run: |
|
||||
cd ./modules/gui/src-tauri/target/release/bundle/macos/ && zip -r tea.zip tea.app
|
||||
|
||||
- name: publish .zip(.app) for MacOS
|
||||
if: startsWith(matrix.platform.name, 'darwin')
|
||||
env:
|
||||
platform: ${{ steps.build_platform.outputs.build_platform }}
|
||||
extension: ${{ steps.build_platform.outputs.extension }}
|
||||
tag: ${{ steps.tag.outputs.tag }}
|
||||
run: |
|
||||
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/macos/tea.zip" \
|
||||
"s3://preview.gui.tea.xyz/release/tea_gui_latest_$platform.zip"
|
||||
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/macos/tea.zip" \
|
||||
"s3://preview.gui.tea.xyz/release/tea_gui_${{ steps.tag.outputs.tag }}_$platform.zip"
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
@ -108,13 +146,3 @@ jobs:
|
|||
VERSION: ${{steps.tag.outputs.tag}}
|
||||
EXT: ${{ steps.build_platform.outputs.extension }}
|
||||
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_gui_${{steps.tag.outputs.tag}}_${{steps.build_platform.outputs.build_platform}}.${{ steps.build_platform.outputs.extension }}
|
||||
|
||||
- name: Slack Notification for .app Mac
|
||||
run: ./.github/notify-slack.js
|
||||
if: startsWith(matrix.platform.name, 'darwin')
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
PLATFORM: ${{ matrix.platform.name }}
|
||||
VERSION: ${{steps.tag.outputs.tag}}
|
||||
EXT: .zip(.app)
|
||||
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_gui_${{steps.tag.outputs.tag}}_${{steps.build_platform.outputs.build_platform}}.zip
|
||||
|
|
Loading…
Reference in a new issue