This repository was archived by the owner on Jun 13, 2026. It is now read-only.
fixing deploy #13
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.2.3)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository_owner }}/sensor-log-generator | |
| PYTHON_VERSION: "3.11" | |
| jobs: | |
| test: | |
| name: Run Tests Before Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install dependencies | |
| run: uv sync --frozen | |
| - name: Run tests | |
| run: | | |
| uv run pytest tests/ -v | |
| build-and-push: | |
| name: Build and Push Release | |
| runs-on: ubuntu-latest | |
| needs: test | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed for git describe and changelog | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="v${{ github.event.inputs.version }}" | |
| # Create and push the tag if it doesn't exist | |
| if ! git rev-parse "$VERSION" >/dev/null 2>&1; then | |
| git tag "$VERSION" | |
| git push origin "$VERSION" | |
| fi | |
| else | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT | |
| - name: Generate Changelog | |
| id: changelog | |
| run: | | |
| # Get the previous tag | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${VERSION}^" 2>/dev/null || echo "") | |
| if [ -z "$PREVIOUS_TAG" ]; then | |
| echo "No previous tag found, including all commits" | |
| COMMIT_RANGE="" | |
| else | |
| echo "Generating changelog from $PREVIOUS_TAG to $VERSION" | |
| COMMIT_RANGE="$PREVIOUS_TAG..$VERSION" | |
| fi | |
| # Generate changelog | |
| { | |
| echo "CHANGELOG<<EOF" | |
| echo "## 🚀 What's Changed" | |
| echo "" | |
| # Features | |
| FEATURES=$(git log $COMMIT_RANGE --pretty=format:"* %s (%h)" --grep="^feat" 2>/dev/null) | |
| if [ -n "$FEATURES" ]; then | |
| echo "### ✨ Features" | |
| echo "$FEATURES" | |
| echo "" | |
| fi | |
| # Bug fixes | |
| FIXES=$(git log $COMMIT_RANGE --pretty=format:"* %s (%h)" --grep="^fix" 2>/dev/null) | |
| if [ -n "$FIXES" ]; then | |
| echo "### 🐛 Bug Fixes" | |
| echo "$FIXES" | |
| echo "" | |
| fi | |
| # Documentation | |
| DOCS=$(git log $COMMIT_RANGE --pretty=format:"* %s (%h)" --grep="^docs" 2>/dev/null) | |
| if [ -n "$DOCS" ]; then | |
| echo "### 📚 Documentation" | |
| echo "$DOCS" | |
| echo "" | |
| fi | |
| # Performance | |
| PERF=$(git log $COMMIT_RANGE --pretty=format:"* %s (%h)" --grep="^perf" 2>/dev/null) | |
| if [ -n "$PERF" ]; then | |
| echo "### ⚡ Performance" | |
| echo "$PERF" | |
| echo "" | |
| fi | |
| # All other commits | |
| OTHER=$(git log $COMMIT_RANGE --pretty=format:"* %s (%h)" --grep="^feat" --grep="^fix" --grep="^docs" --grep="^perf" --invert-grep 2>/dev/null) | |
| if [ -n "$OTHER" ]; then | |
| echo "### 🔧 Other Changes" | |
| echo "$OTHER" | |
| echo "" | |
| fi | |
| # Contributors | |
| echo "### 👥 Contributors" | |
| git log $COMMIT_RANGE --pretty=format:"* @%an" | sort -u | |
| echo "" | |
| # Statistics | |
| if [ -n "$COMMIT_RANGE" ]; then | |
| echo "### 📊 Statistics" | |
| COMMITS=$(git rev-list --count $COMMIT_RANGE) | |
| FILES=$(git diff --stat $COMMIT_RANGE | tail -1) | |
| echo "* $COMMITS commits" | |
| echo "* $FILES" | |
| fi | |
| echo "EOF" | |
| } >> $GITHUB_OUTPUT | |
| - name: Build and push with build.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Install Python dependencies for build script | |
| pip install rich click semver pyyaml | |
| # Set CI environment variable to ensure proper tagging | |
| export CI=true | |
| # Build and push with the specific version tag | |
| python build.py --version-tag ${{ steps.version.outputs.version_number }} | |
| # Additional tags for releases | |
| docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ steps.version.outputs.version_number }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| # Create major and minor version tags | |
| MAJOR=$(echo ${{ steps.version.outputs.version_number }} | cut -d. -f1) | |
| MINOR=$(echo ${{ steps.version.outputs.version_number }} | cut -d. -f1,2) | |
| docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ steps.version.outputs.version_number }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${MAJOR} | |
| docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${MAJOR} | |
| docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ steps.version.outputs.version_number }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${MINOR} | |
| docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${MINOR} | |
| - name: Generate SBOM | |
| uses: anchore/sbom-action@v0 | |
| with: | |
| image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ steps.version.outputs.version_number }} | |
| format: spdx-json | |
| output-file: sbom.spdx.json | |
| - name: Sign container image | |
| env: | |
| COSIGN_EXPERIMENTAL: 1 | |
| run: | | |
| # Install cosign | |
| curl -sSL https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64 -o /tmp/cosign | |
| chmod +x /tmp/cosign | |
| # Sign the images | |
| /tmp/cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ steps.version.outputs.version_number }} | |
| /tmp/cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| continue-on-error: true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| name: Release ${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.version, 'beta') || contains(steps.version.outputs.version, 'alpha') || contains(steps.version.outputs.version, 'rc') }} | |
| generate_release_notes: false | |
| files: | | |
| sbom.spdx.json | |
| body: | | |
| ## 🐳 Docker Images | |
| ### Pull the image: | |
| ```bash | |
| # Latest version | |
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| # Specific version | |
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} | |
| # Major version (will update with patches) | |
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v$(echo ${{ steps.version.outputs.version_number }} | cut -d. -f1) | |
| ``` | |
| ### Run the container: | |
| ```bash | |
| # Using docker-compose (recommended) | |
| docker-compose up -d | |
| # Or using docker run | |
| docker run -d \ | |
| --name sensor-log-generator \ | |
| -v $(pwd)/data:/app/data \ | |
| -v $(pwd)/config:/app/config \ | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} | |
| ``` | |
| ### Run with WAL mode disabled (for Docker Desktop on Mac/Windows): | |
| ```bash | |
| docker run -d \ | |
| --name sensor-log-generator \ | |
| -v $(pwd)/data:/app/data \ | |
| -e SENSOR_WAL=false \ | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} | |
| ``` | |
| --- | |
| ${{ steps.changelog.outputs.CHANGELOG }} | |
| --- | |
| ## 📦 Assets | |
| - **SBOM**: Software Bill of Materials attached below | |
| - **Container Signature**: Images are signed with Cosign/Sigstore | |
| ## 🔗 Quick Links | |
| - [Documentation](https://github.com/${{ github.repository }}/blob/main/README.md) | |
| - [Container Registry](https://github.com/${{ github.repository }}/pkgs/container/${{ github.event.repository.name }}) | |
| - [Report Issues](https://github.com/${{ github.repository }}/issues) |