Skip to content

ci(release): exclude ruststack-py from generic Github Release binaries #12

ci(release): exclude ruststack-py from generic Github Release binaries

ci(release): exclude ruststack-py from generic Github Release binaries #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: ruststack-linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
artifact: ruststack-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact: ruststack-macos-arm64
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --exclude ruststack-py
- name: Package binary (Unix)
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/ruststack dist/${{ matrix.artifact }}
chmod +x dist/${{ matrix.artifact }}
cd dist
tar -czvf ${{ matrix.artifact }}.tar.gz ${{ matrix.artifact }}
sha256sum ${{ matrix.artifact }}.tar.gz > ${{ matrix.artifact }}.tar.gz.sha256
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}.tar.gz*
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release
find artifacts -type f -name "*.tar.gz*" -exec cp {} release/ \;
ls -la release/
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: RustStack ${{ steps.version.outputs.version }}
body: |
## RustStack ${{ steps.version.outputs.version }}
A high-fidelity AWS local emulator written in Rust.
### Downloads
| Platform | File |
|----------|------|
| Linux x86_64 | `ruststack-linux-x86_64.tar.gz` |
| macOS x86_64 | `ruststack-macos-x86_64.tar.gz` |
| macOS ARM64 | `ruststack-macos-arm64.tar.gz` |
### Verify checksums
```bash
sha256sum -c ruststack-*.tar.gz.sha256
```
### Quick Start
```bash
tar -xzf ruststack-linux-x86_64.tar.gz
chmod +x ruststack-linux-x86_64
./ruststack-linux-x86_64 --port 4566
```
files: release/*
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
docker:
name: Docker Image
runs-on: ubuntu-latest
needs: build
if: ${{ !contains(github.ref, '-') }} # Skip for pre-releases
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.release
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}:latest
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.version=${{ steps.version.outputs.version }}