Skip to content

publish

publish #42

Workflow file for this run

name: "publish"
on:
workflow_dispatch:
inputs:
app:
type: choice
description: "app name (e.g. friendshipper)"
required: true
options:
- friendshipper
- birdie
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
jobs:
publish-tauri:
permissions:
contents: write
outputs:
appVersion: ${{ steps.tauri.outputs.appVersion }}
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest-xlarge" # for Arm based macs (M1 and above).
runner: "macos-latest-xlarge"
args: "--target aarch64-apple-darwin"
# - platform: "macos-latest-xlarge" # for Intel based macs.
# runner: "macos-latest-xlarge"
# args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
runner: "linux-8cores"
args: ""
- platform: "windows-latest"
runner: "windows-8cores"
args: ""
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
cache-dependency-path: "${{ github.event.inputs.app }}/yarn.lock"
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest-xlarge' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.0-dev \
libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: Build core ui
run: |
cd core/ui
yarn
yarn package
- name: install frontend dependencies
run: |
cd ${{ github.event.inputs.app }}
yarn install # change this to npm, pnpm or bun depending on which one you use.
- uses: tauri-apps/tauri-action@v0
id: tauri
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: "--max_old_space_size=4096"
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
projectPath: ${{ github.event.inputs.app }}
includeUpdaterJson: true
tagName: ${{ github.event.inputs.app }}-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: "${{ github.event.inputs.app }} v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
# This step has been moved to a separate job
rename-latest-json:
needs: publish-tauri
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Rename latest.json
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=${{ github.event.inputs.app }}-v${{ needs.publish-tauri.outputs.appVersion }}
gh release download $TAG --pattern "latest.json"
mv latest.json ${{ github.event.inputs.app }}.json
gh release upload $TAG ${{ github.event.inputs.app }}.json --clobber
gh release delete-asset $TAG latest.json
- name: Upload other app JSON files
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=${{ github.event.inputs.app }}-v${{ needs.publish-tauri.outputs.appVersion }}
CURRENT_APP=${{ github.event.inputs.app }}.json
# Get the latest release
LATEST_RELEASE=$(gh release list --exclude-drafts --limit 1 | awk '{print $4}')
# Download all JSON files from the latest release
gh release download $LATEST_RELEASE --dir temp --pattern "*.json" || exit 0
# Upload all JSON files except the current app's JSON
for file in temp/*.json; do
if [ "$(basename $file)" != "$CURRENT_APP" ]; then
gh release upload $TAG $file --clobber
fi
done
# Clean up
rm -rf temp