Repository navigation
128 lines (111 loc) · 3.82 KB
/
Copy pathrelease.yml
File metadata and controls
128 lines (111 loc) · 3.82 KB
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
name: Release
on:
pull_request:
branches:
- dev
- main
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
quality-gate:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
- name: Install Rust stable with Clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './whatsapp-lite/src-tauri -> target'
- name: Check formatting
working-directory: ./whatsapp-lite/src-tauri
run: cargo fmt --check
- name: Run Clippy
working-directory: ./whatsapp-lite/src-tauri
run: cargo clippy --all-targets -- -D warnings
- name: Run tests
working-directory: ./whatsapp-lite/src-tauri
run: cargo test --all-targets
release:
if: startsWith(github.ref, 'refs/tags/')
needs: quality-gate
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './whatsapp-lite/src-tauri -> target'
- name: Extract changelog notes
id: extract_changelog
shell: bash
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
if [[ ! "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$ ]]; then
echo "Invalid release tag: $RELEASE_TAG" >&2
exit 1
fi
VERSION="${RELEASE_TAG#v}"
sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '1d;$d' > notes.md
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
cat notes.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Install frontend dependencies
run: npm ci
working-directory: ./whatsapp-lite
- name: Build and Release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: ./whatsapp-lite
tagName: ${{ github.ref_name }}
releaseName: 'WhatsApp Tauri ${{ github.ref_name }}'
releaseBody: |
${{ steps.extract_changelog.outputs.NOTES }}
---
*Built by Wpnnt using Tauri v2.*
releaseDraft: true
# Stable by default: mark as prerelease only for preview tags with a suffix (e.g. v0.3.2-dev)
prerelease: ${{ contains(github.ref_name, '-') }}
publish-release:
if: startsWith(github.ref, 'refs/tags/')
needs: release
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Publish release after all platform builds succeed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: gh release edit "$RELEASE_TAG" --draft=false