From f75abf0beb02e1f2a1c228ff782eb1fee5a69807 Mon Sep 17 00:00:00 2001
From: Matias Verdier <verdier.matias@gmail.com>
Date: Sun, 27 Feb 2022 15:33:59 -0300
Subject: [PATCH] feat: gh action to build the app artifacts

---
 .github/workflows/main.yml | 65 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 .github/workflows/main.yml

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..357a8cb
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,65 @@
+name: Build Twincy App.
+
+on:
+  push:
+    branches: [ tauri-migration ]
+  pull_request:
+    branches: [ tauri-migration ]
+
+jobs:
+  build:
+    strategy:
+      fail-fast: false
+      matrix:
+        os:
+          - macos-latest
+          - ubuntu-latest
+          - windows-latest
+
+    runs-on: ${{ matrix.os }}
+    steps:
+    - uses: actions/checkout@v2
+
+    - name: Setup Rust cache
+      uses: actions/cache@v2
+      with:
+        key: ${{ matrix.os }}-${{ hashFiles('packages/admin/src-tauri/Cargo.lock') }}
+        path: |
+            ~/.cargo/registry/index
+            ~/.cargo/registry/cache
+            ~/.cargo/git
+            ./packages/admin/src-tauri/target
+    - name: Install Node.js
+      uses: actions/setup-node@v2
+      with:
+        node-version: 16
+        cache: npm
+        cache-dependency-path: |
+          package-lock.json
+          
+    - name: 🦀 Install Rust
+      uses: actions-rs/toolchain@v1
+      with: { toolchain: stable }
+
+    - name: Install webkit2gtk (ubuntu only)
+      if: matrix.os == 'ubuntu-latest'
+      run: |
+        sudo apt-get update
+        sudo apt-get upgrade -y --no-install-recommends webkit2gtk-4.0
+
+    - name: Install Node.js dependencies
+      run: npm install
+
+    - name: Download Rust dependencies
+      run: cargo fetch --manifest-path=packages/admin/src-tauri/Cargo.toml
+
+    - name: Build application
+      run: npm run build:tauri
+
+    - name: Upload release artifacts
+      uses: actions/upload-artifact@v2
+      with:
+        name: release-${{ matrix.os }}
+        path: |
+          packages/admin/src-tauri/target/release/bundle
+          packages/admin/src-tauri/target/release/twincy-admin*
\ No newline at end of file