WIP #12
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: Release Pipeline | |
on: | |
push: | |
branches: | |
- 'feature/ci' | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build-pipeline: | |
name: "Build ${{ matrix.target }}" | |
strategy: | |
matrix: | |
target: | |
- aarch64-unknown-linux-gnu | |
- aarch64-apple-darwin | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
- x86_64-unknown-linux-gnu | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
cross: true | |
- target: aarch64-apple-darwin | |
os: macos-13 | |
- target: x86_64-apple-darwin | |
os: macos-13 | |
- target: x86_64-pc-windows-msvc | |
os: windows-2022 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
profile: minimal | |
target: ${{ matrix.target }} | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --locked --target=${{ matrix.target }} | |
use-cross: ${{ matrix.cross }} | |
- name: Create Unix Archive | |
if: ${{ !contains(matrix.target, 'windows') }} | |
env: | |
TARGET: ${{ matrix.target }} | |
srcdir: . | |
pkgdir: /tmp/pkg | |
run: | | |
mkdir -p $pkgdir | |
. scripts/ci/install | |
tar -czf tpi-${{ matrix.target }}.tar.gz $pkgdir | |
- name: Upload Archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: | | |
tpi-${{ matrix.target }}.tar.gz | |
target/${{ matrix.target }}/release/tpi.exe | |
debian-packages: | |
runs-on: ubuntu-latest | |
needs: build-pipeline | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-unknown-linux-gnu | |
- name: Extract tar.gz file | |
run: | | |
mkdir tpi-x86_64-unknown-linux-gnu | |
tar -xf tpi-x86_64-unknown-linux-gnu.tar.gz -C tpi-x86_64-unknown-linux-gnu | |
rm -rf tpi-x86_64-unknown-linux-gnu.tar.gz | |
- name: Create DEBIAN package | |
run: scripts/ci/create_debian_control.sh Cargo.toml amd64 tpi-x86_64-unknown-linux-gnu | |
- run: dpkg-deb --build tpi-x86_64-unknown-linux-gnu | |
- name: Upload Archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: x86_64-unknown-linux-gnu-deb | |
path: | | |
tpi-x86_64-unknown-linux-gnu.deb |