upgrade tauri 2 from beta to rc, migrate permissions and main.rs #109
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
name: 'Build' | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main, release] | |
pull_request: | |
jobs: | |
build-tauri: | |
name: 🐂 Build with Tauri | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential libwebkit2gtk-4.1-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev | |
- name: Install frontend dependencies | |
run: yarn | |
- name: Lint check | |
if: matrix.platform == 'ubuntu-latest' | |
run: yarn lint | |
- name: Build with tauri to test | |
if: github.ref != 'refs/heads/release' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and publish with tauri | |
if: github.ref == 'refs/heads/release' | |
id: create-release | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version | |
releaseName: 'Emoji Mart v__VERSION__' | |
releaseBody: 'See the assets to download this version and install.' | |
releaseDraft: false | |
prerelease: false | |
- uses: actions/upload-artifact@v4 | |
if: matrix.platform == 'ubuntu-latest' | |
with: | |
name: artifacts | |
path: | | |
src-tauri/target/release/**/*.exe | |
src-tauri/target/release/**/*.msi | |
src-tauri/target/release/**/*.deb | |
src-tauri/target/release/**/*.AppImage | |
src-tauri/target/release/**/*.dmg | |
!src-tauri/target/release/deps | |
!src-tauri/target/release/build | |
- name: Get current commit ID | |
id: get_commit | |
run: echo "{commit_id}=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
outputs: | |
version: ${{ steps.create-release.outputs.version }} | |
commit_id: ${{ steps.get_commit.outputs.commit_id }} | |
# This job will try to build the flatpak and upload it to the release or action artifacts | |
# The actual Flathub build and release happens in the Flathub CI at https://github.com/flathub/io.github.vemonet.EmojiMart | |
build-flatpak: | |
name: 📦️ Build with Flatpak | |
needs: build-tauri | |
runs-on: ubuntu-latest | |
container: | |
image: bilelmoussaoui/flatpak-github-actions:gnome-45 | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: flathub/io.github.vemonet.EmojiMart | |
ref: dev | |
submodules: 'recursive' | |
- name: Update package version in flatpak manifest for release | |
if: github.ref == 'refs/heads/release' | |
env: | |
PACKAGE_VERSION: ${{ needs.build-tauri.outputs.version }} | |
run: | | |
sed -i "s/tag: v[0-9]*\.[0-9]*\.[0-9]*$/tag: v$PACKAGE_VERSION/g" ./io.github.vemonet.EmojiMart.yml | |
sed -i "s/<releases>$/<releases>\\n <release version=\"$PACKAGE_VERSION\" date=\"$(date +%Y-%m-%d)\">\\n <\/release>\\n/g" ./io.github.vemonet.EmojiMart.appdata.xml | |
echo "🏷️ Publishing $PACKAGE_VERSION" | |
# NOTE: use device=all for ydotool on wayland | |
# sed -i "s/- --device=dri/- --device=all/g" ./io.github.vemonet.EmojiMart.yml | |
- name: Update commit in flatpak manifest for test | |
if: github.ref != 'refs/heads/release' | |
env: | |
COMMIT_ID: ${{ needs.build-tauri.outputs.commit_id }} | |
run: | | |
sed -i "s/tag: v[0-9]*\.[0-9]*\.[0-9]*$/commit: $COMMIT_ID/g" ./io.github.vemonet.EmojiMart.yml | |
echo "🏷️ Testing $COMMIT_ID" | |
- name: Build flatpak | |
uses: flatpak/flatpak-github-actions/flatpak-builder@v6 | |
with: | |
bundle: EmojiMart.flatpak | |
manifest-path: io.github.vemonet.EmojiMart.yml | |
cache-key: flatpak-builder-${{ github.sha }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: EmojiMart.flatpak | |
path: EmojiMart.flatpak | |
- name: Update Release | |
if: github.ref == 'refs/heads/release' | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
EmojiMart.flatpak | |
tag_name: v${{ github.env.PACKAGE_VERSION }} |