gui/.github/workflows/release.yml
2022-12-27 12:21:19 +08:00

107 lines
3.8 KiB
YAML

on:
push:
tags:
- 'v*.*.*'
jobs:
build_release_tauri:
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- os: macos-11
name: darwin+x86-64
- os: ubuntu-latest
name: linux+x86-64
- os: [self-hosted, macOS, ARM64]
name: darwin+aarch64
# - os: [self-hosted, linux, ARM64]
# name: linux+aarch64
container: ${{ matrix.platform.container }}
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: build platform output
id: build_platform
env:
platform: ${{ matrix.platform.name }}
run: |
BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g")
EXTENSION=dmg
[[ $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
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
# default: "v0-rust"
prefix-key: ${{ matrix.platform.name }}
shared-key: prod
cache-targets: false
- name: install dependencies (ubuntu only)
if: matrix.platform.name == 'linux+x86-64'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install app dependencies
run: pnpm install
- name: Cache Tauri Target
uses: actions/cache@v3
with:
path: |
./modules/gui/src-tauri/target
key: ${{ matrix.platform.name }}-build-target-prod
restore-keys: |
${{ matrix.platform.name }}-build-target-prod
- name: test build tauri
run: pnpm --filter gui tauri build
- name: Get current unix ts - seconds
id: date
run: echo "unix_seconds=$(date +'%s')" >> $GITHUB_OUTPUT
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
# update and replace latest release bin in s3
- name: Set tag
id: tag
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: publish release
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/$extension/tea_0.1.0_$platform.$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" \
"s3://preview.gui.tea.xyz/release/tea_gui_$tag_$platform.$extension"
- name: Slack Notification
run: ./.github/notify-slack.js
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
PLATFORM: ${{ matrix.platform.name }}
VERSION: ${{steps.tag.outputs.tag}}
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 }}