Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

Add automated build workflow

tilakpatel222e0e212eb614
diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml
deleted file mode 100644
index 82e712237..000000000
--- a/.github/workflows/build-and-release.yml
+++ /dev/null
@@ -1,200 +0,0 @@
-name: Build FinceptTerminal
-on:
- push:
- branches: [ main ]
- pull_request:
- branches: [ main ]
- workflow_dispatch: # Allows manual trigger
-
-jobs:
- build:
- strategy:
- fail-fast: false
- matrix:
- include:
- - platform: 'macos-latest'
- target: 'aarch64-apple-darwin'
- arch: 'arm64'
- os_name: 'macOS'
- file_ext: '.dmg'
- - platform: 'macos-latest'
- target: 'x86_64-apple-darwin'
- arch: 'x64'
- os_name: 'macOS'
- file_ext: '.dmg'
- - platform: 'ubuntu-22.04'
- target: 'x86_64-unknown-linux-gnu'
- arch: 'x64'
- os_name: 'Linux'
- file_ext: '.AppImage'
- - platform: 'windows-latest'
- target: 'x86_64-pc-windows-msvc'
- arch: 'x64'
- os_name: 'Windows'
- file_ext: '.msi'
-
- runs-on: ${{ matrix.platform }}
-
- outputs:
- version: ${{ steps.get_version.outputs.version }}
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Get version from Cargo.toml
- id: get_version
- run: |
- if [ "${{ runner.os }}" = "Windows" ]; then
- VERSION=$(grep '^version = ' src-tauri/Cargo.toml | head -n1 | cut -d '"' -f2)
- echo "version=$VERSION" >> $GITHUB_OUTPUT
- else
- VERSION=$(grep '^version = ' src-tauri/Cargo.toml | head -n1 | cut -d '"' -f2)
- echo "version=$VERSION" >> $GITHUB_OUTPUT
- fi
- shell: bash
-
- - name: Install dependencies (ubuntu only)
- if: matrix.platform == 'ubuntu-22.04'
- run: |
- sudo apt-get update
- sudo apt-get install -y \
- libwebkit2gtk-4.1-dev \
- libwebkit2gtk-4.0-dev \
- libjavascriptcoregtk-4.1-dev \
- libjavascriptcoregtk-4.0-dev \
- libsoup-3.0-dev \
- libsoup2.4-dev \
- build-essential \
- curl \
- wget \
- file \
- libssl-dev \
- libgtk-3-dev \
- libayatana-appindicator3-dev \
- librsvg2-dev \
- patchelf
-
- - name: Rust setup
- uses: dtolnay/rust-toolchain@stable
- with:
- targets: ${{ matrix.target }}
-
- - name: Rust cache
- uses: swatinem/rust-cache@v2
- with:
- workspaces: './src-tauri -> target'
- key: ${{ matrix.target }}
-
- - name: Sync node version and setup cache
- uses: actions/setup-node@v4
- with:
- node-version: 'lts/*'
- cache: 'npm'
-
- - name: Install frontend dependencies
- run: npm install
-
- - name: Build the app
- uses: tauri-apps/tauri-action@v0
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- args: '--target ${{ matrix.target }}'
-
- - name: Upload artifacts
- uses: actions/upload-artifact@v4
- with:
- name: finceptterminal-${{ matrix.os_name }}-${{ matrix.arch }}
- path: |
- src-tauri/target/${{ matrix.target }}/release/bundle/
- !src-tauri/target/${{ matrix.target }}/release/bundle/**/*.dSYM/
- retention-days: 30
-
- update-readme:
- needs: build
- runs-on: ubuntu-latest
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Download all artifacts
- uses: actions/download-artifact@v4
- with:
- path: ./artifacts
-
- - name: Update README with download links
- run: |
- # Get the run ID and commit SHA
- RUN_ID="${{ github.run_id }}"
- COMMIT_SHA="${{ github.sha }}"
- SHORT_SHA=${COMMIT_SHA:0:7}
- VERSION="${{ needs.build.outputs.version }}"
- REPO_URL="https://github.com/${{ github.repository }}"
-
- # Create the download links section
- cat > download_section.md << EOF
- ## 📥 Download Latest Build
-
- **Version:** \`v${VERSION}\` | **Commit:** \`${SHORT_SHA}\` | **Build:** [#${RUN_ID}](${REPO_URL}/actions/runs/${RUN_ID})
-
- | Platform | Architecture | Download |
- |----------|-------------|----------|
- | 🍎 **macOS** | Apple Silicon (ARM64) | [![Download](https://img.shields.io/badge/Download-macOS%20ARM64-blue?style=for-the-badge&logo=apple)](${REPO_URL}/actions/runs/${RUN_ID}/artifacts) |
- | 🍎 **macOS** | Intel (x64) | [![Download](https://img.shields.io/badge/Download-macOS%20x64-blue?style=for-the-badge&logo=apple)](${REPO_URL}/actions/runs/${RUN_ID}/artifacts) |
- | 🐧 **Linux** | x64 | [![Download](https://img.shields.io/badge/Download-Linux%20x64-green?style=for-the-badge&logo=linux)](${REPO_URL}/actions/runs/${RUN_ID}/artifacts) |
- | 🪟 **Windows** | x64 | [![Download](https://img.shields.io/badge/Download-Windows%20x64-red?style=for-the-badge&logo=windows)](${REPO_URL}/actions/runs/${RUN_ID}/artifacts) |
-
- > **Note:** Click on the download buttons above to access the artifacts page, then download the specific build for your platform.
-
- ### 📋 Installation Instructions
-
- - **macOS**: Download the \`.dmg\` file, open it, and drag FinceptTerminal to Applications
- - **Linux**: Download the \`.AppImage\` file, make it executable (\`chmod +x\`), and run
- - **Windows**: Download the \`.msi\` file and run the installer
-
- ---
- EOF
-
- # Check if README has the download section markers
- if grep -q "<!-- DOWNLOAD_SECTION_START -->" README.md && grep -q "<!-- DOWNLOAD_SECTION_END -->" README.md; then
- # Replace existing section
- sed -i '/<!-- DOWNLOAD_SECTION_START -->/,/<!-- DOWNLOAD_SECTION_END -->/c\
- <!-- DOWNLOAD_SECTION_START -->\
- '"$(cat download_section.md | sed 's/$/\\/')"'\
- <!-- DOWNLOAD_SECTION_END -->' README.md
- else
- # Add section at the top after the title
- if grep -q "^# " README.md; then
- # Insert after the first heading
- sed -i '/^# /r download_section.md' README.md
- sed -i '/^# /a\\n<!-- DOWNLOAD_SECTION_START -->' README.md
- sed -i '/<!-- DOWNLOAD_SECTION_START -->/,/---/a\<!-- DOWNLOAD_SECTION_END -->' README.md
- else
- # Prepend to file
- cat download_section.md README.md > temp_readme.md
- mv temp_readme.md README.md
- sed -i '1i<!-- DOWNLOAD_SECTION_START -->' README.md
- sed -i '/---/a\<!-- DOWNLOAD_SECTION_END -->' README.md
- fi
- fi
-
- # Clean up
- rm download_section.md
-
- - name: Commit and push changes
- run: |
- git config --local user.email "[email protected]"
- git config --local user.name "GitHub Action"
-
- if git diff --quiet; then
- echo "No changes to commit"
- else
- git add README.md
- git commit -m "🚀 Update download links for build #${{ github.run_id }}"
- git push
- fi
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..c3bb8a479
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,246 @@
+name: Build FinceptTerminal
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ workflow_dispatch: # Allows manual trigger
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - platform: 'macos-latest'
+ target: 'aarch64-apple-darwin'
+ arch: 'arm64'
+ os_name: 'macOS'
+ - platform: 'macos-latest'
+ target: 'x86_64-apple-darwin'
+ arch: 'x64'
+ os_name: 'macOS'
+ - platform: 'ubuntu-22.04'
+ target: 'x86_64-unknown-linux-gnu'
+ arch: 'x64'
+ os_name: 'Linux'
+ - platform: 'windows-latest'
+ target: 'x86_64-pc-windows-msvc'
+ arch: 'x64'
+ os_name: 'Windows'
+
+ runs-on: ${{ matrix.platform }}
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Install dependencies (ubuntu only)
+ if: matrix.platform == 'ubuntu-22.04'
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y \
+ libwebkit2gtk-4.1-dev \
+ libwebkit2gtk-4.0-dev \
+ libjavascriptcoregtk-4.1-dev \
+ libjavascriptcoregtk-4.0-dev \
+ libsoup-3.0-dev \
+ libsoup2.4-dev \
+ build-essential \
+ curl \
+ wget \
+ file \
+ libssl-dev \
+ libgtk-3-dev \
+ libayatana-appindicator3-dev \
+ librsvg2-dev \
+ patchelf
+
+ - name: Rust setup
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: ${{ matrix.target }}
+
+ - name: Rust cache
+ uses: swatinem/rust-cache@v2
+ with:
+ workspaces: './src-tauri -> target'
+ key: ${{ matrix.target }}
+
+ - name: Sync node version and setup cache
+ uses: actions/setup-node@v4
+ with:
+ node-version: 'lts/*'
+ cache: 'npm'
+
+ - name: Install frontend dependencies
+ run: npm install
+
+ - name: Build the app
+ uses: tauri-apps/tauri-action@v0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ args: '--target ${{ matrix.target }}'
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: finceptterminal-${{ matrix.os_name }}-${{ matrix.arch }}
+ path: |
+ src-tauri/target/${{ matrix.target }}/release/bundle/
+ !src-tauri/target/${{ matrix.target }}/release/bundle/**/*.dSYM/
+ retention-days: 30
+
+ update-readme:
+ needs: build
+ runs-on: ubuntu-latest
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ fetch-depth: 0
+
+ - name: Get version from Cargo.toml
+ id: get_version
+ run: |
+ if [ -f "src-tauri/Cargo.toml" ]; then
+ VERSION=$(grep '^version = ' src-tauri/Cargo.toml | head -n1 | cut -d '"' -f2)
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ else
+ echo "version=1.0.0" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Update README with download links
+ run: |
+ # Get the run ID and commit SHA
+ RUN_ID="${{ github.run_id }}"
+ COMMIT_SHA="${{ github.sha }}"
+ SHORT_SHA=${COMMIT_SHA:0:7}
+ VERSION="${{ steps.get_version.outputs.version }}"
+ REPO_URL="https://github.com/${{ github.repository }}"
+ CURRENT_DATE=$(date -u +"%Y-%m-%d %H:%M UTC")
+
+ # Create the download links section
+ cat > download_section.md << 'EOF'
+## 📥 Download Latest Build
+
+**Version:** `v$VERSION` | **Commit:** `$SHORT_SHA` | **Build:** [#$RUN_ID]($REPO_URL/actions/runs/$RUN_ID) | **Updated:** $CURRENT_DATE
+
+| Platform | Architecture | Download |
+|----------|-------------|----------|
+| 🍎 **macOS** | Apple Silicon (ARM64) | [![Download](https://img.shields.io/badge/Download-macOS%20ARM64-blue?style=for-the-badge&logo=apple)]($REPO_URL/actions/runs/$RUN_ID/artifacts) |
+| 🍎 **macOS** | Intel (x64) | [![Download](https://img.shields.io/badge/Download-macOS%20x64-blue?style=for-the-badge&logo=apple)]($REPO_URL/actions/runs/$RUN_ID/artifacts) |
+| 🐧 **Linux** | x64 | [![Download](https://img.shields.io/badge/Download-Linux%20x64-green?style=for-the-badge&logo=linux)]($REPO_URL/actions/runs/$RUN_ID/artifacts) |
+| 🪟 **Windows** | x64 | [![Download](https://img.shields.io/badge/Download-Windows%20x64-red?style=for-the-badge&logo=windows)]($REPO_URL/actions/runs/$RUN_ID/artifacts) |
+
+> **Note:** Click on the download buttons above to access the artifacts page, then download the specific build for your platform.
+
+### 📋 Installation Instructions
+
+- **macOS**: Download the `.dmg` file, open it, and drag FinceptTerminal to Applications
+- **Linux**: Download the `.AppImage` file, make it executable (`chmod +x`), and run
+- **Windows**: Download the `.msi` file and run the installer
+
+---
+EOF
+
+ # Replace variables in the template
+ sed -i "s/\$VERSION/$VERSION/g" download_section.md
+ sed -i "s/\$SHORT_SHA/$SHORT_SHA/g" download_section.md
+ sed -i "s/\$RUN_ID/$RUN_ID/g" download_section.md
+ sed -i "s|\$REPO_URL|$REPO_URL|g" download_section.md
+ sed -i "s/\$CURRENT_DATE/$CURRENT_DATE/g" download_section.md
+
+ # Check if README exists
+ if [ ! -f "README.md" ]; then
+ echo "Creating new README.md"
+ echo "# FinceptTerminal" > README.md
+ echo "" >> README.md
+ fi
+
+ # Check if README has the download section markers
+ if grep -q "<!-- DOWNLOAD_SECTION_START -->" README.md && grep -q "<!-- DOWNLOAD_SECTION_END -->" README.md; then
+ echo "Updating existing download section"
+ # Create a temporary file with the new content
+ awk '
+ /<!-- DOWNLOAD_SECTION_START -->/ {
+ print $0
+ print ""
+ system("cat download_section.md")
+ while (getline > 0 && !/<!-- DOWNLOAD_SECTION_END -->/) continue
+ print "<!-- DOWNLOAD_SECTION_END -->"
+ next
+ }
+ { print }
+ ' README.md > temp_readme.md
+ mv temp_readme.md README.md
+ else
+ echo "Adding new download section"
+ # Add markers and section after the first heading or at the beginning
+ if grep -q "^# " README.md; then
+ # Insert after the first heading
+ awk '
+ /^# / && !inserted {
+ print $0
+ print ""
+ print "<!-- DOWNLOAD_SECTION_START -->"
+ system("cat download_section.md")
+ print "<!-- DOWNLOAD_SECTION_END -->"
+ print ""
+ inserted = 1
+ next
+ }
+ { print }
+ ' README.md > temp_readme.md
+ mv temp_readme.md README.md
+ else
+ # Prepend to file
+ {
+ echo "<!-- DOWNLOAD_SECTION_START -->"
+ cat download_section.md
+ echo "<!-- DOWNLOAD_SECTION_END -->"
+ echo ""
+ cat README.md
+ } > temp_readme.md
+ mv temp_readme.md README.md
+ fi
+ fi
+
+ # Clean up
+ rm -f download_section.md
+
+ - name: Commit and push changes
+ run: |
+ git config --local user.email "[email protected]"
+ git config --local user.name "GitHub Action Bot"
+
+ # Check if there are any changes
+ if git diff --quiet README.md; then
+ echo "No changes to commit"
+ else
+ git add README.md
+ git commit -m "🚀 Auto-update download links for build #${{ github.run_id }}"
+
+ # Retry push up to 3 times in case of conflicts
+ for i in {1..3}; do
+ if git push; then
+ echo "Successfully pushed changes"
+ break
+ else
+ echo "Push failed, attempt $i/3"
+ if [ $i -lt 3 ]; then
+ echo "Pulling latest changes and retrying..."
+ git pull --rebase
+ sleep 5
+ else
+ echo "Failed to push after 3 attempts"
+ exit 1
+ fi
+ fi
+ done
+ fi
\ No newline at end of file