|
| 1 | +name: Build and Release Andromeda |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build and Release |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + # Linux (x86_64) |
| 18 | + - os: ubuntu-latest |
| 19 | + rust-target: x86_64-unknown-linux-gnu |
| 20 | + asset-name: andromeda-linux-amd64 |
| 21 | + |
| 22 | + # macOS (Intel) |
| 23 | + - os: macos-latest |
| 24 | + rust-target: x86_64-apple-darwin |
| 25 | + asset-name: andromeda-macos-amd64 |
| 26 | + |
| 27 | + # macOS (Apple Silicon/ARM) |
| 28 | + - os: macos-latest |
| 29 | + rust-target: aarch64-apple-darwin |
| 30 | + asset-name: andromeda-macos-arm64 |
| 31 | + |
| 32 | + # Windows |
| 33 | + - os: windows-latest |
| 34 | + rust-target: x86_64-pc-windows-msvc |
| 35 | + asset-name: andromeda-windows-amd64.exe |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + |
| 40 | + - name: Install Rust |
| 41 | + uses: actions-rs/toolchain@v1 |
| 42 | + with: |
| 43 | + profile: minimal |
| 44 | + toolchain: stable |
| 45 | + override: true |
| 46 | + target: ${{ matrix.rust-target }} |
| 47 | + |
| 48 | + - uses: Swatinem/rust-cache@v2 |
| 49 | + |
| 50 | + - name: Build |
| 51 | + uses: actions-rs/cargo@v1 |
| 52 | + with: |
| 53 | + command: build |
| 54 | + args: --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml |
| 55 | + |
| 56 | + - name: Prepare binary |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + cd target/${{ matrix.rust-target }}/release/ |
| 60 | + if [ "${{ matrix.os }}" = "windows-latest" ]; then |
| 61 | + mv andromeda.exe ${{ matrix.asset-name }} |
| 62 | + else |
| 63 | + mv andromeda ${{ matrix.asset-name }} |
| 64 | + fi |
| 65 | + |
| 66 | + - name: Upload Binary to Release (Tag Only) |
| 67 | + if: startsWith(github.ref, 'refs/tags/') |
| 68 | + uses: svenstaro/upload-release-action@v2 |
| 69 | + with: |
| 70 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + file: target/${{ matrix.rust-target }}/release/${{ matrix.asset-name }} |
| 72 | + asset_name: ${{ matrix.asset-name }} |
| 73 | + tag: ${{ github.ref }} |
| 74 | + overwrite: true |
| 75 | + |
| 76 | + - name: Upload Binary as Artifact (Main Branch) |
| 77 | + if: github.ref == 'refs/heads/main' |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: ${{ matrix.asset-name }} |
| 81 | + path: target/${{ matrix.rust-target }}/release/${{ matrix.asset-name }} |
0 commit comments