Skip to content

Commit 43fe7d6

Browse files
authored
Merge pull request #10 from tchapgouv/1-add-build-release-action
feat: build release script and action
2 parents 18a64d8 + 0624a1e commit 43fe7d6

31 files changed

+1394
-26
lines changed

.github/workflows/publish.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: "publish"
2+
3+
on:
4+
push:
5+
tags:
6+
- "tchap-*"
7+
8+
# `tauri-action` can also upload app bundles to an existing GitHub release.
9+
# This workflow uses different actions to create and publish the release.
10+
# `tauri-action` will only build and upload the app bundles to the specified release.
11+
12+
jobs:
13+
create-release:
14+
permissions:
15+
contents: write
16+
runs-on: ubuntu-latest
17+
outputs:
18+
release_id: ${{ steps.create-release.outputs.result }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: setup node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: lts/*
27+
28+
- name: get version
29+
run: echo "PACKAGE_VERSION=$(node -p "require('./src-tauri/tauri.conf.json').version")" >> $GITHUB_ENV
30+
31+
- name: create release
32+
id: create-release
33+
uses: actions/github-script@v6
34+
with:
35+
script: |
36+
const { data } = await github.rest.repos.createRelease({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
tag_name: `app-v${process.env.PACKAGE_VERSION}`,
40+
name: `Tchap Desktop App v${process.env.PACKAGE_VERSION}`,
41+
body: 'Take a look at the assets to download and install tchap as a desktop app.',
42+
draft: true,
43+
prerelease: false
44+
})
45+
return data.id
46+
47+
build-tauri:
48+
needs: create-release
49+
permissions:
50+
contents: write
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
include:
55+
- platform: "windows-latest"
56+
args: ""
57+
58+
runs-on: ${{ matrix.platform }}
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: setup node
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: lts/*
66+
67+
- name: install Rust stable
68+
uses: dtolnay/rust-toolchain@stable
69+
with:
70+
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
71+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
72+
73+
- name: install frontend dependencies
74+
run: |
75+
npm install
76+
npm run fetch-package
77+
78+
- uses: tauri-apps/tauri-action@v0
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
releaseId: ${{ needs.create-release.outputs.release_id }}
83+
args: ${{ matrix.args }}
84+
includeDebug: true
85+
86+
publish-release:
87+
permissions:
88+
contents: write
89+
runs-on: ubuntu-latest
90+
needs: [create-release, build-tauri]
91+
92+
steps:
93+
- name: publish release
94+
id: publish-release
95+
uses: actions/github-script@v6
96+
env:
97+
release_id: ${{ needs.create-release.outputs.release_id }}
98+
with:
99+
script: |
100+
github.rest.repos.updateRelease({
101+
owner: context.repo.owner,
102+
repo: context.repo.repo,
103+
release_id: process.env.release_id,
104+
draft: false,
105+
prerelease: false
106+
})

.github/workflows/test_build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "test-on-build"
2+
3+
on: [pull_request]
4+
5+
# This workflow will build your tauri app without uploading it anywhere.
6+
7+
jobs:
8+
test-tauri:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- platform: "windows-latest"
14+
args: ""
15+
16+
runs-on: ${{ matrix.platform }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: setup node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: lts/*
24+
25+
- name: install Rust stable
26+
uses: dtolnay/rust-toolchain@stable
27+
with:
28+
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
29+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
30+
31+
- name: install frontend dependencies
32+
run: |
33+
npm install
34+
npm run fetch-package
35+
36+
# If tagName and releaseId are omitted tauri-action will only build the app and won't try to upload any assets.
37+
- uses: tauri-apps/tauri-action@v0
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
args: ${{ matrix.args }}

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ dist
1212
dist-ssr
1313
*.local
1414

15+
deploys
1516
# Editor directories and files
1617
.vscode/*
17-
!.vscode/extensions.json
1818
.idea
1919
.DS_Store
2020
*.suo
2121
*.ntvs*
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
26+
# tchap
27+
archives/*
28+
!archives/.gitkeep
29+
src/*
30+
!src/.gitkeep

.vscode/extensions.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,46 @@ Client Desktop Tchap avec Tauri ( https://tauri.app )
55

66
## Dev
77

8-
- Télécharger une release de Tchap Web et placer le contenu de dist dans src
8+
- Install prerequisites https://v2.tauri.app/start/prerequisites/)
9+
10+
- Live testing with tchap-web
11+
- Create a symbolic link to tchap-web-v4 webapp folder into
912
```
10-
curl https://github.com/tchapgouv/tchap-web-v4/releases/download/tchap-4.13.0/tchap-4.13.0-prod-20250115.tar.gz
11-
tar -xvf tchap-4.13.0/tchap-4.13.0-prod-20250115.tar.gz
12-
mv dist src
13+
ln -s $PATH_TO_TCHAP_WEB_WEBAPP src/
1314
```
14-
15-
- Tester localement (installer les prérequis au préalable https://v2.tauri.app/start/prerequisites/)
15+
- if the webapp folder doesnt exist you need to run first in tchap-web-v4
1616
```
17-
cargo tauri dev
17+
CONFIG=dev ./scripts/tchap/package-tchap.sh
1818
```
1919

20-
- Compiler tchap pour votre système
20+
- Then come back to tchap-desktop
2121
```
22-
cargo tauri build
22+
npm install
23+
24+
npm run fetch-package
25+
26+
cargo tauri dev
27+
2328
```
2429

25-
- Live testing with tchap-web
26-
Create a sumbolic link to tchap-web-v4 webapp folder into
30+
- you can change in `package.json` the version of tchap-web that you want to use in `tchapConfig.tchap-web_version` and `tchapConfig.tchap-web_version`. Make the change before running `fetch-package` script
31+
32+
Then you will be able to build your tchap webb and have the modification directly here
33+
34+
35+
## Build
2736
```
28-
ln -s $PATH_TO_TCHAPWEB src/
37+
npm install
38+
39+
npm run fetch-package
40+
41+
cargo tauri build
2942
3043
```
31-
Then you will be able to build your tchap webb and have the modification directly here
3244

45+
### Github workflow
46+
-
3347

48+
## Release version
49+
- The release version is taken from the tauri-conf file. So before creating a new tag for release, you have to update this version
50+
- The tag need to follow the format `tchap-*`

archives/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)