Skip to content

Commit

Permalink
Use github for building
Browse files Browse the repository at this point in the history
  • Loading branch information
dedene committed Mar 18, 2023
1 parent 6a41e8a commit 26a84be
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: [ "main" ]
branches: ['main']

jobs:
frontend:
Expand Down Expand Up @@ -57,30 +57,12 @@ jobs:
platform: ~
cross: false

- name: linux-armv7-gnu
os: ubuntu-20.04
target: armv7-unknown-linux-gnueabihf
platform: ~
cross: true

- name: linux-arm64-gnu
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
platform: ~
cross: true

- name: linux-x86-64-musl
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
platform: amd64
cross: true

- name: linux-arm64-musl
os: ubuntu-20.04
target: aarch64-unknown-linux-musl
platform: arm64
cross: true

steps:
- uses: actions/checkout@v3
- run: rustup toolchain install stable --profile minimal
Expand All @@ -105,8 +87,34 @@ jobs:

- name: Build
if: ${{ !matrix.cross }}
run: cargo build --release --locked --target ${{ matrix.target }} --manifest-path backend/Cargo.toml
run:
cargo build --release --locked --target ${{ matrix.target }} --manifest-path
backend/Cargo.toml

- name: Cross build
if: ${{ matrix.cross }}
run: cross build --release --locked --target ${{ matrix.target }} --manifest-path backend/Cargo.toml
run:
cross build --release --locked --target ${{ matrix.target }} --manifest-path
backend/Cargo.toml

- name: Copy binaries
if: ${{ matrix.platform == null }}
shell: bash
run: |
mkdir -p bin
src="backend/target/${{ matrix.target }}/release/mailcrab-backend"
dst="bin/mailcrab-${{ matrix.name }}-${{ github.ref_name }}"
cp "$src" "$dst"
sha256sum -b "$dst" > "$dst.sha256"
- name: Copy binary
if: ${{ matrix.platform != null }}
run:
mkdir -p bin && cp backend/target/${{ matrix.target }}/release/mailcrab-backend bin/${{
matrix.platform }}

- uses: actions/upload-artifact@v3
if: ${{ matrix.platform != null }}
with:
name: ${{ matrix.platform }}-build-${{ github.ref_name }}
path: bin/${{ matrix.platform }}

0 comments on commit 26a84be

Please sign in to comment.