Skip to content

Publish Search App

Publish Search App #65

name: Publish Search App
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
build:
name: Publish
strategy:
matrix:
settings:
- runner: harana-dev-mac-x86
target: x86_64-apple-darwin
bundles: app,dmg
os: darwin
arch: x86_64
- runner: harana-dev-mac-arm64
target: aarch64-apple-darwin
bundles: app,dmg
os: darwin
arch: aarch64
# - host: windows-latest
# target: x86_64-pc-windows-msvc
# bundles: msi
# os: windows
# arch: x86_64
# - host: windows-latest
# target: aarch64-pc-windows-msvc
- runner: harana-dev-linux
target: x86_64-unknown-linux-gnu
bundles: deb,appimage
os: linux
arch: x86_64
# - runner: harana-dev-linux
# target: aarch64-unknown-linux-gnu
# bundles: deb
runs-on: ${{ matrix.settings.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: search
- name: Checkout search engine repo
uses: actions/checkout@v4
with:
repository: harana/search-engine
path: search-engine
token: ${{ secrets.READ_REPOSITORIES_TOKEN }}
- name: Get Branch/Tag
id: ref
uses: frabert/replace-string-action@v1.2
with:
pattern: 'refs\/\w+\/(.*)'
string: ${{ github.ref }}d
replace-with: '$1'
- name: Get Short SHA
uses: benjlevesque/short-sha@v1.2
id: short-sha
with:
length: 6
- name: Get Version
uses: haya14busa/action-cond@v1
id: version
with:
cond: ${{ contains(github.ref, 'tag') }}
if_true: ${{ steps.ref.outputs.replaced }}
if_false: ${{ steps.ref.outputs.replaced }}-${{ steps.short-sha.outputs.sha }}
- name: Setup Cache
run: |
mkdir -p /opt/cache/cargo_git_cache
mkdir -p /opt/cache/cargo_registry_cache
mkdir -p /opt/cache/coursier_cache
mkdir -p /opt/cache/ivy2_cache
mkdir -p /opt/cache/sbt_cache
mkdir -p ~/.cache
mkdir -p ~/.cargo
mkdir -p ~/.ivy2
mkdir -p ~/.sbt
rm -fr /opt/cache/coursier_cache/v1/https/maven.pkg.github.com/harana
ln -s /opt/cache/cargo_git_cache $HOME/.cargo/git || true
ln -s /opt/cache/cargo_registry_cache $HOME/.cargo/registry || true
ln -s /opt/cache/coursier_cache $HOME/.cache/coursier || true
ln -s /opt/cache/ivy2_cache $HOME/.ivy2/cache || true
ln -s /opt/cache/sbt_cache $HOME/.sbt/boot || true
- name: Install Apple API key
if: ${{ runner.os == 'macOS' }}
run: |
mkdir -p ~/.appstoreconnect/private_keys/
cd ~/.appstoreconnect/private_keys/
echo ${{ secrets.APPLE_API_KEY_BASE64 }} >> AuthKey_${{ secrets.APPLE_API_KEY }}.p8.base64
base64 --decode -i AuthKey_${{ secrets.APPLE_API_KEY }}.p8.base64 -o AuthKey_${{ secrets.APPLE_API_KEY }}.p8
rm AuthKey_${{ secrets.APPLE_API_KEY }}.p8.base64
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\spacedrive_target
New-Item -Path target -ItemType Junction -Value C:\spacedrive_target
- name: Populate Credentials
run: |
mkdir -p $HOME/.sbt/1.0/plugins
if [ ! -f '$HOME/.sbt/1.0/plugins/credentials.sbt' ]; then
cat <<EOF > $HOME/.sbt/1.0/plugins/credentials.sbt
credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", "nadenf", System.getenv("GITHUB_TOKEN"))
EOF
fi
- name: Install Frontend Dependencies
run: |
cd search
pnpm install
- name: Build Frontend
env:
GITHUB_TOKEN: ${{ secrets.WRITE_PACKAGES_TOKEN }}
run: |
cd search
sbt buildFrontend
- name: Build Conan Libraries
run: |
cd search-engine
cargo update
conan profile detect || true
conan install --build=missing -of=build -d=full_deploy .
- name: Build Tauri
run: |
source /etc/profile
cd search
mkdir -p dist
pnpm run css
cd src-tauri
cargo update
pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }},updater
env:
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_PROVIDER_SHORT_NAME: ${{ secrets.APPLE_PROVIDER_SHORT_NAME }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_PRIVATE_KEY }}
FFMPEG_DIR: "$HOME/.conan2/p/b/ffmpe4f423bfc61572/p"
NODE_OPTIONS: "--max_old_space_size=8196"
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
- name: Publish Artifacts
uses: ./search/.github/actions/publish-artifacts
with:
os: ${{ matrix.settings.os }}
arch: ${{ matrix.settings.arch }}
target: ${{ matrix.settings.target }}
profile: release
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
name: Create Release
needs: build
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: '*/**'
- name: Notify Slack - Success
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_FOOTER: ""
SLACK_MESSAGE: "✅ harana-${{ github.event.repository.name }} | publish | ${{ steps.version.outputs.value }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_BUILDS_WEBHOOK }}
- name: Notify Slack - Failure
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_FOOTER: ""
SLACK_MESSAGE: "⛔️ harana-${{ github.event.repository.name }} | publish | ${{ steps.version.outputs.value }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_BUILDS_WEBHOOK }}
- name: Output Version
if: success()
run: |
echo ${{ steps.version.outputs.value }}