Skip to content

VoScript v0.8.4

VoScript v0.8.4 #16

Workflow file for this run

name: Build and publish Docker image
on:
release:
types: [published]
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install Rust toolchain
run: rustup toolchain install stable --profile minimal
- name: Install maturin
run: python -m pip install "maturin>=1.13,<2"
- name: Build Rust wheel
run: python -m maturin build --release --manifest-path crates/voscript_core/Cargo.toml --features extension-module --out dist
- name: Stage Rust wheel for Docker context
id: wheel
run: |
set -euo pipefail
mkdir -p app/.wheelhouse
wheel_count="$(find dist -maxdepth 1 -name 'voscript_core-*.whl' | wc -l | tr -d ' ')"
if [ "$wheel_count" != "1" ]; then
echo "Expected exactly one voscript_core wheel, found $wheel_count" >&2
find dist -maxdepth 1 -type f >&2
exit 1
fi
wheel_path="$(find dist -maxdepth 1 -name 'voscript_core-*.whl' -print -quit)"
cp "$wheel_path" app/.wheelhouse/
echo "name=$(basename "$wheel_path")" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Compute image tags
id: tags
run: |
GHCR_IMAGE="ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')"
DOCKERHUB_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/voscript"
TAGS="$GHCR_IMAGE:latest,$DOCKERHUB_IMAGE:latest"
# Tag-triggered builds (release or push-tag) get the version tag too.
# Strip leading "v" for Docker Hub convention (0.7.0), keep raw ref for GHCR.
if [ "${{ github.event_name }}" = "release" ] || [ "${{ github.event_name }}" = "push" ]; then
RAW_VERSION="${GITHUB_REF#refs/tags/}"
STRIPPED_VERSION="${RAW_VERSION#v}"
TAGS="$TAGS,$GHCR_IMAGE:$RAW_VERSION,$DOCKERHUB_IMAGE:$STRIPPED_VERSION"
fi
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./app
platforms: linux/amd64
push: true
build-args: |
VOSCRIPT_CORE_WHEEL=${{ steps.wheel.outputs.name }}
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max