Skip to content

Commit

Permalink
feat: build + release Workflow (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uninen committed Jun 16, 2022
1 parent c3dea4b commit 4fe6984
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 71 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.1
with:
version: 7
run_install: true

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'pnpm'

- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Build Vite + Tauri
run: pnpm build

- name: 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: 'v__VERSION__'
releaseBody: 'See the assets to download and install this version.'
releaseDraft: true
prerelease: false
54 changes: 54 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build

on:
push:
branches:
- main
paths:
- 'src/**'
- 'src-tauri/**'
- 'tests/**'
- 'pnpm-lock.yaml'
- '.github/workflows/test.yml'
workflow_dispatch:

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
test-build:
strategy:
fail-fast: true
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3

- name: Install pnpm + deps
uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: true

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Build Vite + Tauri
run: pnpm build
59 changes: 1 addition & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,9 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: /home/runner/.local/share/pnpm/store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
with:
version: 7.0.0-rc.8
version: 7
run_install: true

- name: Use Node.js
Expand All @@ -49,52 +41,3 @@ jobs:

- name: Run unit tests
run: pnpm test

build:
needs: [test]
if: ${{ github.event.pull_request.merged }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: /home/runner/.local/share/pnpm/store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
with:
version: 7.0.0-rc.8
run_install: true

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'pnpm'

- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf libayatana-appindicator3-dev
- name: Build Vite + Tauri
run: pnpm build

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.1.0 (2022-06-16)

Hello Tauri 1.0!

- Feat: Added a separate release workflow.
- Refactor: converted menu to use `Menu::os_default`. Thank You to @JonasKruckenberg! for the tip!
- Docs: added more docs on usage, fixed prerequisites link.
- Chore: Bumped all Vite + Tauri deps.

## 0.0.1 (2022-04-27)

- Initial version
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pnpm i

## Usage

### Development

#### Running Tauri + Vite Development Server

```sh
Expand All @@ -35,17 +37,30 @@ pnpm dev
pnpm test
```

#### Upgrading Rust Dependencies

You can upgrade your Rust dependencies with the included [cargo-edit](https://github.com/killercup/cargo-edit) tool. In `src-tauri/` say

```sh
cargo upgrade
```

### Building and releasing

#### Building

The project has GitHub Actions set up which will automatically test and build your app with every push and PR. For building manually:

```sh
pnpm build
```

## Roadmap
#### Releasing a new version

- [x] Add basic usability features
- [ ] Build + release with GitHub Actions
- [ ] Add documentation for devtools etc
1. Bump version number (In `package.json`, and `src-tauri/`)
2. Run `pnpm check` to update `Cargo.lock`
3. Tag the commit you want to release with `vX.Y.Z`
4. Github workflow will automatically build a new draft release for this version. Edit the release notes and publish when ready 🎉

## Elsewhere

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "tauri-vite-template",
"name": "tauri-vue-template",
"private": true,
"version": "0.0.2",
"version": "0.1.0",
"scripts": {
"dev": "vite-tauri dev",
"build": "vite-tauri build",
"vite:dev": "vite dev",
"vite:build": "vite build",
"test": "vitest",
"ts-check": "vue-tsc --noEmit",
"preview": "vite preview"
"preview": "vite preview",
"check": "cd src-tauri && cargo check"
},
"dependencies": {
"@tauri-apps/api": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "app"
version = "0.0.1"
version = "0.1.0"
description = "A Tauri App"
authors = ["Ville Säävuori"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![backend_add])
.menu(
tauri::Menu::os_default("Tauri Vite Template").add_submenu(Submenu::new(
tauri::Menu::os_default("Tauri Vue Template").add_submenu(Submenu::new(
"Help",
Menu::with_items([CustomMenuItem::new(
"Online Documentation",
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "tauri-vite-template",
"version": "0.0.1"
"productName": "tauri-vue-template",
"version": "0.1.0"
},
"build": {
"distDir": "../dist",
Expand Down Expand Up @@ -51,7 +51,7 @@
},
"windows": [
{
"title": "tauri-vite-template",
"title": "tauri-vue-template",
"width": 800,
"height": 600,
"resizable": true,
Expand Down

0 comments on commit 4fe6984

Please sign in to comment.