refactor: improve release pipeline

This commit is contained in:
Gustavo Carvalho
2025-12-13 16:00:39 -03:00
parent e64ae37a7f
commit 002283cb15

View File

@@ -12,26 +12,77 @@ env:
CARGO_TERM_COLOR: always
jobs:
create-release:
name: Create Release
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create-release.outputs.id }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
id: create-release
# --- BUILD STEPS ---
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file \
libssl-dev libayatana-appindicator3-dev librsvg2-dev libxdo-dev \
libgtk-3-dev libglib2.0-dev
- name: Update version files
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
echo "Syncing version to $VERSION"
npm version $VERSION --no-git-tag-version
sed -i "s/\"version\": \"[0-9]*\.[0-9]*\.[0-9]*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json
sed -i "s/^version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"$VERSION\"/" src-tauri/Cargo.toml
- name: Install npm dependencies
run: npm ci
- name: Build Tauri app
run: npm run tauri:build
# --- RELEASE STEP ---
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
files: |
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage
src-tauri/target/release/bundle/rpm/*.rpm
body: |
## Windows 11 Clipboard History For Linux ${{ github.ref_name }}
@@ -69,84 +120,5 @@ jobs:
2. **Log out and log back in** for permissions to take effect
The `.deb` and `.rpm` packages do this automatically during installation.
### Changelog
See the [commit history](https://github.com/gustavosett/Windows-11-Clipboard-History-For-Linux/commits/${{ github.ref_name }}) for changes.
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-linux:
name: Build Linux
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update version files
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
echo "Syncing version to $VERSION"
npm version $VERSION --no-git-tag-version
sed -i "s/\"version\": \"[0-9]*\.[0-9]*\.[0-9]*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json
sed -i "s/^version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"$VERSION\"/" src-tauri/Cargo.toml
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file \
libssl-dev libayatana-appindicator3-dev librsvg2-dev libxdo-dev \
libgtk-3-dev libglib2.0-dev
- name: Install npm dependencies
run: npm ci
- name: Build Tauri app
run: npm run tauri:build
- name: Upload DEB to Release
uses: softprops/action-gh-release@v2
with:
files: src-tauri/target/release/bundle/deb/*.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload AppImage to Release
uses: softprops/action-gh-release@v2
with:
files: src-tauri/target/release/bundle/appimage/*.AppImage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload RPM to Release
uses: softprops/action-gh-release@v2
with:
files: src-tauri/target/release/bundle/rpm/*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}