🚀🖥️ Release APPs #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# RELEASE APPS | |
############################################################################### | |
name: 🚀🖥️ Release APPs | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Set number for release version' | |
type: string | |
required: true | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
REPO_TEST: ${{ github.repository }}:test | |
REPO_LATEST: ${{ github.repository }}:latest | |
############################################################################### | |
# JOBS | |
############################################################################### | |
jobs: | |
release_apps: | |
permissions: | |
contents: write | |
deployments: write | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- platform: 'macos-13-xlarge' | |
tauriScript: 'pnpm tauri' | |
# args: '--target universal-apple-darwin' | |
# - platform: 'macos-latest' | |
# args: '--target x86_64-apple-darwin' | |
# - platform: 'macos-latest' | |
# args: '--target aarch64-apple-darwin' | |
# - platform: 'macos-latest' | |
- platform: 'ubuntu-22.04' | |
tauriScript: 'pnpm tauri' | |
- platform: 'windows-latest' | |
tauriScript: 'pnpm exec tauri' # this because script tauri has $@ and windows dont support it | |
timeout-minutes: 20 | |
runs-on: ${{ matrix.settings.platform }} | |
env: | |
UPDATED_VERSION: ${{ github.event.inputs.version }} | |
steps: | |
######################################################################### | |
# INIT & INSTALL | |
######################################################################### | |
- name: ⬇️ Checkout repository | |
uses: actions/checkout@v4 | |
- name: 🦀 Rust setup | |
if: matrix.settings.platform == 'macos-latest' | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: 'aarch64-apple-darwin,x86_64-apple-darwin' | |
- name: 🦀 Rust setup | |
if: matrix.settings.platform != 'macos-latest' | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: 🦀 Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: './src-tauri -> target' | |
- name: 📦 Install pnpm | |
uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
- name: 📦 Sync node version and setup cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'pnpm' # Set this to npm, yarn or pnpm. | |
- name: 📦📄 Get package.json name | |
id: pkg | |
run: | | |
echo "name=$(jq -r '.extra.productName' ./package.json)" >> $GITHUB_OUTPUT | |
echo "description=$(jq -r '.description' ./package.json)" >> $GITHUB_OUTPUT | |
echo "homepage=$(jq -r '.homepage' ./package.json)" >> $GITHUB_OUTPUT | |
echo "docs=$(jq -r '.extra.docsUrl' ./package.json)" >> $GITHUB_OUTPUT | |
echo "repo=$(jq -r '.repository.url' ./package.json)" >> $GITHUB_OUTPUT | |
- name: 🦀 install dependencies (ubuntu only) | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: ⬇️📦 Install dependencies | |
run: | | |
pnpm install --no-frozen-lockfile | |
######################################################################### | |
# BUILD | |
######################################################################### | |
# important because app works with the core local package | |
- name: 🏗 Build | |
run: pnpm core build && pnpm app build | |
######################################################################### | |
# APP - BUILD & RELEASE DESKTOP APP | |
######################################################################### | |
- name: 🖥️ Build the app | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
# @see https://github.com/tauri-apps/tauri-action?tab=readme-ov-file#inputs | |
projectPath: 'packages/app' | |
tagName: "${{ env.UPDATED_VERSION }}" | |
releaseName: '${{ steps.pkg.outputs.name }} v${{ env.UPDATED_VERSION }}' | |
releaseBody: | | |
${{ steps.pkg.outputs.name }} apps and extensions v${{ env.UPDATED_VERSION }} | |
${{ steps.pkg.outputs.description }} | |
--- | |
🌐 WEB: ${{ steps.pkg.outputs.homepage }} | |
📚 DOCUMENTATION:${{ steps.pkg.outputs.docs }} | |
🧩 CHANGELOG: ${{ steps.pkg.outputs.repo }}/blob/main/packages/app/CHANGELOG.md | |
📜 LICENSE: ${{ steps.pkg.outputs.repo }}/blob/main/LICENSE | |
releaseDraft: false | |
prerelease: false | |
includeUpdaterJson: true | |
updaterJsonKeepUniversal: true # @see https://github.com/tauri-apps/tauri-action?tab=readme-ov-file#build-options | |
includeRelease: true | |
tauriScript: ${{ matrix.settings.tauriScript }} | |
# args: ${{ matrix.settings.args }} | |
######################################################################### | |
# APP - PUBLISH WEB | |
######################################################################### | |
- name: 🖥️🌥 Deploy APP in cloudflare pages | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
projectName: "super8" | |
directory: 'packages/app/build' | |
wranglerVersion: '3' | |
######################################################################### | |
# APP - PUSH DOCKER IMAGE | |
######################################################################### | |
- name: 🐳☑️ Set up QEMU | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
uses: docker/setup-qemu-action@v1 | |
- name: 🐳☑️ Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
- name: 🐳 Login to Docker Hub | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
uses: docker/login-action@v1 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: 🐳🚀 Build and push image | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
uses: docker/build-push-action@v4 | |
with: | |
context: packages/app | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ github.repository }}:${{ env.UPDATED_VERSION }} | |
${{ env.REPO_LATEST }} | |
- name: 🐳📝 Update Docker Hub metadata | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ github.repository }}:${{ env.UPDATED_VERSION }},$${{ env.REPO_LATEST }} | |
# description: ${{ steps.pkg.outputs.description }} | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: 🐳📝 Update Docker Hub repo description | |
if: matrix.settings.platform == 'ubuntu-22.04' | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
# @see https://github.com/peter-evans/dockerhub-description | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
repository: ${{ github.repository }} | |
short-description: ${{ steps.pkg.outputs.description }} | |
readme-filepath: ./README.md | |
############################################################################### |