Skip to content

Commit

Permalink
OCS-17 distribute binaryapp bundle (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregor Zweig <zwickzwackzwieback@gmail.com>
  • Loading branch information
flys1ck and Gregor Zweig authored Dec 23, 2023
1 parent 952a11d commit c0f81a2
Show file tree
Hide file tree
Showing 14 changed files with 457 additions and 114 deletions.
69 changes: 11 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ concurrency:
jobs:
build:
name: Build
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -29,15 +24,12 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 21
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install Rust toolchain
run: |
rustup update --no-self-update 1.72.0
rustup component add --toolchain 1.72.0 rustfmt rust-src
rustup default 1.72.0
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable

- run: pnpm install

Expand All @@ -46,48 +38,18 @@ jobs:
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- run: echo "PGN_EXTRACT_VERSION=22-11" >> $GITHUB_ENV

- uses: actions/cache@v3
id: pgn-extract-cache
with:
path: |
external/pgn-extract
key: pgn-extract-${{ env.PGN_EXTRACT_VERSION }}

- name: Install pgn-extract
run: make pgn-extract
if: steps.pgn-extract-cache.outputs.cache-hit != 'true'
env:
PGN_EXTRACT_VERSION: ${{ env.PGN_EXTRACT_VERSION }}

- run: echo "STOCKFISH_VERSION=16" >> $GITHUB_ENV

- run: echo "STOCKFISH_PLATFORM=ubuntu" >> $GITHUB_ENV
# if: "{{matrix.platform == ubuntu-22.04}}"

- uses: actions/cache@v3
id: stockfish-cache
with:
path: |
external/stockfish
key: stockfish-${{ env.STOCKFISH_VERSION }}-${{ env.STOCKFISH_PLATFORM }}
key: stockfish-${{ env.STOCKFISH_VERSION }}-ubuntu-latest
env:
STOCKFISH_VERSION: 16

- name: Install Stockfish
run: make stockfish
run: node scripts/downloadStockfish.js
if: steps.stockfish-cache.outputs.cache-hit != 'true'
env:
PGN_EXTRACT_VERSION: ${{ env.PGN_EXTRACT_VERSION }}
STOCKFISH_VERSION: ${{ env.STOCKFISH_VERSION }}
STOCKFISH_PLATFORM: ${{ env.STOCKFISH_PLATFORM }}

# - name: Mock bundled binaries
# run: |
# mkdir external
# mkdir -p src-tauri/bin
# touch external/stockfish
# touch external/pgn-extract
# node scripts/generateTargetTriple.js

- name: Generate Target Triple
run: |
Expand All @@ -98,15 +60,6 @@ jobs:
with:
workspaces: src-tauri -> target

- name: Build application
run: pnpm tauri build --ci

- uses: actions/upload-artifact@v3
with:
name: release-ubuntu-deb
path: src-tauri/target/release/bundle/deb/openchess_0.0.0_amd64.deb

- uses: actions/upload-artifact@v3
with:
name: release-ubuntu-appimage
path: src-tauri/target/release/bundle/appimage/openchess_0.0.0_amd64.AppImage
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ubuntu-20.04, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 21
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install OS dependencies
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Install frontend dependencies
run: pnpm install

- uses: actions/cache@v3
id: stockfish-cache
with:
path: |
external/stockfish
key: stockfish-${{ env.STOCKFISH_VERSION }}-${{ matrix.platform }}
env:
STOCKFISH_VERSION: 16

- name: Install Stockfish
run: node scripts/downloadStockfish.js
if: steps.stockfish-cache.outputs.cache-hit != 'true'

- name: Generate Target Triples
run: |
mkdir src-tauri/bin
node scripts/generateTargetTriple.js
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__
releaseName: OpenChess v__VERSION__
releaseDraft: true
prerelease: true
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,3 @@ pgn-extract:
cd external/pgn-extract-$(PGN_EXTRACT_VERSION) && make pgn-extract
mv -f external/pgn-extract-$(PGN_EXTRACT_VERSION)/pgn-extract external
rm -rf external/pgn-extract-$(PGN_EXTRACT_VERSION)

stockfish:
mkdir -p external
rm -f external/stockfish
curl -fsSL https://github.com/official-stockfish/Stockfish/releases/download/sf_${STOCKFISH_VERSION}/stockfish-$(STOCKFISH_PLATFORM)-x86-64-modern.tar --output external/stockfish.tar
tar -xf external/stockfish.tar -C external
mv -f external/stockfish/stockfish-$(STOCKFISH_PLATFORM)-x86-64-modern external
rm -rf external/stockfish
mv -f external/stockfish-$(STOCKFISH_PLATFORM)-x86-64-modern external/stockfish
rm -f external/stockfish.tar
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,23 @@
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/typescript": "^1.8.20",
"autoprefixer": "^10.4.16",
"cpu-features": "^0.0.9",
"dotenv": "^16.3.1",
"eslint": "^8.54.0",
"eslint-plugin-vue": "^9.18.1",
"execa": "^8.0.1",
"follow-redirects": "^1.15.3",
"happy-dom": "^12.10.3",
"kysely-codegen": "^0.11.0",
"postcss": "^8.4.31",
"prettier": "^3.1.0",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.7",
"tailwindcss": "^3.3.5",
"tar": "^6.2.0",
"typescript": "^5.3.2",
"unplugin-vue-router": "^0.7.0",
"unzipper": "^0.10.14",
"vite": "^5.0.2",
"vite-plugin-vue-layouts": "^0.8.0",
"vite-tsconfig-paths": "^4.2.1",
Expand Down
Loading

0 comments on commit c0f81a2

Please sign in to comment.