mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
update
This commit is contained in:
@@ -0,0 +1,176 @@
|
|||||||
|
name: Release Bichon
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
env:
|
||||||
|
BINARY_NAME: bichon
|
||||||
|
|
||||||
|
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 --features vendored-openssl --target=${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Strip binary (Linux and macOS)
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
run: |
|
||||||
|
strip target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
|
||||||
|
|
||||||
|
- name: Pack artifact (Linux/macOS)
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p release
|
||||||
|
BINARY="target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}"
|
||||||
|
cp README.md LICENSE release/
|
||||||
|
cp "$BINARY" release/
|
||||||
|
tar -czvf "${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" -C release .
|
||||||
|
mv "${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" release/
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.target }}
|
||||||
|
path: release/${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
|
||||||
|
|
||||||
|
- name: Create zip archive (Windows)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
mkdir -p release
|
||||||
|
$BINARY = "target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}.exe"
|
||||||
|
Copy-Item -Path $BINARY -Destination release/
|
||||||
|
Copy-Item -Path README.md -Destination release/
|
||||||
|
Copy-Item -Path LICENSE -Destination release/
|
||||||
|
Compress-Archive -Path release\* -DestinationPath "release/${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.zip" -Force
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.target }}
|
||||||
|
path: release/${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.zip
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create GitHub Release
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download build artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
pattern: "*"
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Flatten artifacts
|
||||||
|
run: |
|
||||||
|
mkdir -p artifacts
|
||||||
|
find artifacts -type f -name "*.zip" -exec mv {} artifacts/ \;
|
||||||
|
find artifacts -type f -name "*.tar.gz" -exec mv {} artifacts/ \;
|
||||||
|
|
||||||
|
- name: Debug list files
|
||||||
|
run: ls -R artifacts
|
||||||
|
|
||||||
|
- name: Generate SHA256 checksums
|
||||||
|
run: |
|
||||||
|
cd artifacts
|
||||||
|
sha256sum * > SHA256SUMS.txt
|
||||||
|
cat SHA256SUMS.txt
|
||||||
|
|
||||||
|
- name: Publish GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
name: "Release ${{ github.ref_name }}"
|
||||||
|
generate_release_notes: true
|
||||||
|
files: |
|
||||||
|
artifacts/*
|
||||||
|
docker:
|
||||||
|
name: Build and Push Docker Image
|
||||||
|
needs: [build, release]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download Linux musl artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: x86_64-unknown-linux-musl
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Prepare Docker context
|
||||||
|
run: |
|
||||||
|
tar -xzf artifacts/${{ env.BINARY_NAME }}-*.tar.gz -C docker
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./docker
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
rustmailer/bichon:${{ github.ref_name }}
|
||||||
|
rustmailer/bichon:latest
|
||||||
|
build-args: |
|
||||||
|
CRATE_VERSION=${{ github.ref_name }}
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ WORKDIR /opt/bichon
|
|||||||
# Copy compiled binary (ensure it's statically linked or compatible with bullseye)
|
# Copy compiled binary (ensure it's statically linked or compatible with bullseye)
|
||||||
COPY bichon /opt/bichon/bichon
|
COPY bichon /opt/bichon/bichon
|
||||||
COPY LICENSE /opt/bichon/
|
COPY LICENSE /opt/bichon/
|
||||||
COPY license.html /opt/bichon/
|
|
||||||
# Set proper permissions
|
# Set proper permissions
|
||||||
RUN chmod +x /opt/bichon/bichon
|
RUN chmod +x /opt/bichon/bichon
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user