Skip to content

Commit

Permalink
merge 2 workflows in 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Mar 20, 2024
1 parent f4c3a3c commit e01b305
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 122 deletions.
94 changes: 83 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: 'Build app'
on: [push, pull_request, workflow_call, workflow_dispatch]
name: 'Build'
on:
workflow_dispatch:
push:
branches: [main, release]
pull_request:

jobs:
test-tauri:
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@v3
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand All @@ -26,16 +32,82 @@ jobs:
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install app dependencies
- name: Install frontend dependencies
run: yarn

- name: Lint check
if: matrix.platform == 'ubuntu-latest'
run: yarn lint

- name: Build the app
run: yarn build
- name: Build with tauri to test
if: github.ref != 'refs/heads/release'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: tauri-apps/tauri-action@v0
- 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


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: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Update package version in flatpak manifest
# env:
# PACKAGE_VERSION: ${{ needs.create-release.outputs.releaseId }}
run: |
curl -L -o package.json https://raw.github.com/vemonet/EmojiMart/release/package.json
PACKAGE_VERSION=$(node -p "require('./package.json').version")
rm package.json
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
sed -i "s/- --device=dri/- --device=all/g" ./io.github.vemonet.EmojiMart.yml
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"
- name: Build flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1
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 }}
109 changes: 0 additions & 109 deletions .github/workflows/release.yml

This file was deleted.

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ flatpak run io.github.vemonet.EmojiMart --lang fr
gsettings set org.gnome.mutter center-new-windows true
```

<!--
##### ⚠️ Enable auto-paste on Wayland
To enable auto-paste to work on Wayland you will need to give your user permission to read/write to the user input. It is not recommended in regard of security, and Emoji Mart will still work by copying the emoji to your clipboard if you don't make this change. But it is currently the only way we found to automatically paste on Wayland, please let us know if you know of a better way in the issues!
To enable auto-paste to work on Wayland you will need to give your user permission to read/write to the user input. It is not recommended in regard of security, and Emoji Mart will still work by copying the emoji to your clipboard if you don't make this change. But it is currently the only way we found to automatically paste on Wayland, please let us know if you know of a better way in the issues!
First you will need to download and install the `.flatpak` file from the GitHub releases, instead of Flathub:
Expand All @@ -92,6 +94,8 @@ sudo usermod -a -G input $(id -u)
sudo reboot
```
-->

<details><summary>Alternatively, but not recommended, you can also use the <code>.AppImage</code> file</summary>

This is not recommended, as the apps takes longer to startup than with the flatpak, and not all dependencies are included to auto-paste.
Expand Down Expand Up @@ -153,7 +157,8 @@ Inspired by:

## 🛠️ Development

[![Latest release](https://shields.io/github/v/release/vemonet/EmojiMart)](https://github.com/vemonet/EmojiMart/releases/latest) [![Build app](https://github.com/vemonet/EmojiMart/actions/workflows/build.yml/badge.svg)](https://github.com/vemonet/EmojiMart/actions/workflows/build.yml) [![Publish new release](https://github.com/vemonet/EmojiMart/actions/workflows/release.yml/badge.svg)](https://github.com/vemonet/EmojiMart/actions/workflows/release.yml)
[![Latest release](https://shields.io/github/v/release/vemonet/EmojiMart)](https://github.com/vemonet/EmojiMart/releases/latest)
[![Build](https://github.com/vemonet/EmojiMart/actions/workflows/build.yml/badge.svg)](https://github.com/vemonet/EmojiMart/actions/workflows/build.yml)

Built with [Tauri](https://tauri.app/), [Svelte](https://svelte.dev), [TypeScript](https://www.typescriptlang.org/), and [Vite](https://vitejs.dev/).

Expand Down
2 changes: 2 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
if (pickMulti) {
selection.push(emoji.native)
} else {
// Adding to the clipboard and hiding the window is done here
// Rust handles auto-paste
const previous = await clipboard.readText()
clipboard.writeText(emoji.native)
appWindow.hide()
Expand Down

0 comments on commit e01b305

Please sign in to comment.