Semantic Release #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Semantic Release | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
# - alpha | |
jobs: | |
build-and-upload: | |
name: Build and Upload Artifacts | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
include: | |
# - platform: 'macos-latest' # for Arm based macs (M1 and above). | |
# args: '-- --target aarch64-apple-darwin' | |
# - platform: 'macos-latest' # for Intel based macs. | |
# args: '-- --target x86_64-apple-darwin' | |
- platform: 'macos-latest' # for Universal mac. | |
args: '--target universal-apple-darwin' | |
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '' | |
- platform: 'windows-latest' | |
args: '' | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# https://tauri.app/v1/guides/building/cross-platform/#example-workflow | |
- name: Install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.14 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: './src-tauri -> target' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Check linting and errors | |
run: | | |
pnpm run lint | |
pnpm run check | |
- name: Update version declarations | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
pnpx semantic-release --dry-run | |
- name: Build Tauri | |
run: pnpm run tauri build ${{ matrix.args }} | |
- name: Move artifacts to outputs | |
run: | | |
mkdir outputs | |
- name: Move macOS artifacts to outputs | |
if: matrix.platform == 'macos-latest' | |
run: | | |
cp -r src-tauri/target/universal-apple-darwin/release/bundle/dmg/Notpad_*_universal.dmg outputs/ | |
- name: Move Ubuntu artifacts to outputs | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
cp src-tauri/target/release/bundle/deb/Notpad_*_amd64.deb outputs/ | |
cp src-tauri/target/release/bundle/rpm/Notpad-*.x86_64.rpm outputs/ | |
- name: Move Windows artifacts to outputs | |
if: matrix.platform == 'windows-latest' | |
run: | | |
cp src-tauri/target/release/bundle/msi/Notpad_*_x64_en-US.msi outputs/ | |
cp src-tauri/target/release/bundle/nsis/Notpad_*_x64-setup.exe outputs/ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tauri-artifacts-${{ strategy.job-index }} | |
path: outputs/ | |
# path: | | |
# src-tauri/target/universal-apple-darwin/release/bundle/macos/Notpad.app | |
# src-tauri/target/universal-apple-darwin/release/bundle/dmg/Notpad_*_universal.dmg | |
# src-tauri/target/release/bundle/deb/notpad_*_amd64.deb | |
# src-tauri/target/release/bundle/rpm/notpad-*.x86_64.rpm | |
# src-tauri/target/release/bundle/msi/Notpad_*_x64_en-US.msi | |
# src-tauri/target/release/bundle/nsis/Notpad_*_x64-setup.exe | |
retention-days: 1 | |
semantic-release: | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
needs: build-and-upload | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.14 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: tauri-artifacts-* | |
merge-multiple: true | |
- name: Run Semantic Release | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: pnpx semantic-release |