mirror of
https://github.com/rustmailer/rustmailer.git
synced 2026-09-08 08:01:49 +00:00
109 lines
2.8 KiB
YAML
109 lines
2.8 KiB
YAML
name: Release RustMailer
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
- target: x86_64-unknown-linux-musl
|
|
os: ubuntu-latest
|
|
- target: x86_64-apple-darwin
|
|
os: macos-latest
|
|
- target: x86_64-pc-windows-msvc
|
|
os: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
target: ${{ matrix.target }}
|
|
override: true
|
|
|
|
- name: Setup Node.js & pnpm
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install pnpm
|
|
run: npm install -g pnpm
|
|
|
|
- name: Build frontend (web)
|
|
working-directory: ./web
|
|
run: |
|
|
pnpm install
|
|
pnpm run build
|
|
|
|
- name: Install musl-tools (Linux musl only)
|
|
if: matrix.target == 'x86_64-unknown-linux-musl'
|
|
run: sudo apt-get update && sudo apt-get install -y musl-tools
|
|
|
|
- name: Build Rust backend
|
|
run: cargo build --release --target=${{ matrix.target }}
|
|
|
|
- name: Prepare dist directory
|
|
run: mkdir -p dist
|
|
|
|
- name: Copy binary to dist
|
|
run: |
|
|
BIN=rustmailer
|
|
EXT=""
|
|
if [[ "${{ matrix.target }}" == *windows* ]]; then EXT=".exe"; fi
|
|
cp target/${{ matrix.target }}/release/${BIN}${EXT} dist/
|
|
|
|
- name: Pack artifact
|
|
run: |
|
|
cd dist
|
|
tar -czvf rustmailer-${{ github.ref_name }}-${{ matrix.target }}.tar.gz rustmailer*
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.target }}
|
|
path: dist/rustmailer-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
|
|
|
|
release:
|
|
name: Create GitHub Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Download build artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: ./artifacts
|
|
|
|
- name: Generate changelog with git-cliff
|
|
id: changelog
|
|
uses: orhun/git-cliff-action@v2
|
|
with:
|
|
args: --tag ${{ github.ref_name }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Publish GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
name: ${{ github.ref_name }}
|
|
body: ${{ steps.changelog.outputs.content }}
|
|
draft: false
|
|
prerelease: false
|
|
files: ./artifacts/**/*.tar.gz
|