Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyangtingwen committed Apr 18, 2023
1 parent 94e145a commit 05f595f
Showing 1 changed file with 30 additions and 108 deletions.
138 changes: 30 additions & 108 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,118 +1,40 @@
name: Release CI

name: "publish"
on:
push:
branches:
- release # Push events to matching v*, i.e. v1.0, v20.15.10
- master

jobs:
build-chatgptstacks:
runs-on: ${{ matrix.os }}
publish-tauri:
strategy:
fail-fast: false
matrix:
include:
- build: macos
os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
- build: macos
os: macos-latest
arch: aarch64
target: aarch64-apple-darwin
- build: windows
os: windows-latest
arch: x86_64
target: x86_64-pc-windows-msvc

steps:
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14

- name: 'Setup Rust'
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Install xattr (macos only)
if: matrix.os == 'macos-latest'
run: pip install xattr

- name: Install rust target
run: rustup target add ${{ matrix.target }}

- run: yarn && yarn build && yarn tauri build --target ${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: artifacts-${{ matrix.arch }}
path: |
./target/${{ matrix.target }}/release/bundle/dmg/**.dmg
./target/${{ matrix.target }}/release/bundle/macos/**.app.*
platform: [macos-latest, windows-latest]

- uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: artifacts-${{ matrix.arch }}
path: |
./target/${{ matrix.target }}/release/bundle/msi/**
release-chatgptstacks:
needs: build-chatgptstacks
runs-on: macos-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3

- name: Install xattr
run: |
sudo apt-get update
sudo apt-get install -y xattr
- name: Query version number
run: echo "version=${GITHUB_REF:11}" >> $GITHUB_ENV

- name: Download x86_64 artifacts
uses: actions/download-artifact@v3
with:
path: artifacts/x86_64

- name: Download aarch64 artifacts
uses: actions/download-artifact@v3
with:
path: artifacts/aarch64

- name: Rename artifacts
run: |
mv "artifacts/aarch64/dmg/chatgptstacks_${{ env.version }}_aarch64.dmg" "artifacts/chatgptstacks_${{ env.version }}_macos_aarch64.dmg"
mv "artifacts/aarch64/macos/chatgptstacks.app.tar.gz" "artifacts/chatgptstacks_${{ env.version }}_macos_aarch64.app.tar.gz"
mv "artifacts/aarch64/macos/chatgptstacks.app.tar.gz.sig" "artifacts/chatgptstacks_${{ env.version }}_macos_aarch64.app.tar.gz.sig"
mv "artifacts/x86_64/dmg/chatgptstacks_${{ env.version }}_x64.dmg" "artifacts/chatgptstacks_${{ env.version }}_macos_x86_64.dmg"
mv "artifacts/x86_64/macos/chatgptstacks.app.tar.gz" "artifacts/chatgptstacks_${{ env.version }}_macos_x86_64.app.tar.gz"
mv "artifacts/x86_64/macos/chatgptstacks.app.tar.gz.sig" "artifacts/chatgptstacks_${{ env.version }}_macos_x86_64.app.tar.gz.sig"
mv "artifacts/x86_64/chatgptstacks_${{ env.version }}_x64_en-US.msi" "artifacts/chatgptstacks_${{ env.version }}_windows_x86_64.msi"
mv "artifacts/x86_64/chatgptstacks_${{ env.version }}_x64_en-US.msi.zip" "artifacts/chatgptstacks_${{ env.version }}_windows_x86_64.msi.zip"
mv "artifacts/x86_64/chatgptstacks_${{ env.version }}_x64_en-US.msi.zip.sig" "artifacts/chatgptstacks_${{ env.version }}_windows_x86_64.msi.zip.sig"
- name: Create Release
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
name: chatgptstacks v${{ env.version }}
body: See the assets to download this version and install.
prerelease: false
generate_release_notes: false
files: ./artifacts/**/*
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
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 and build it
run: yarn && yarn build && yarn tauri build
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: chatgptstacks-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false

0 comments on commit 05f595f

Please sign in to comment.