-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (118 loc) · 4.59 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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 }}