Skip to content

chore: bump version to 0.6.1 #23

chore: bump version to 0.6.1

chore: bump version to 0.6.1 #23

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
- name: Run tests
run: poetry run pytest --cov=devgraph_integrations --cov-report=xml --cov-report=term
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
- name: Install dependencies
run: poetry install --no-interaction
- name: Run ruff
run: poetry run ruff check .
- name: Run mypy
run: poetry run mypy devgraph_integrations
continue-on-error: true
release:
runs-on: ubuntu-latest
needs: [test, lint]
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- 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: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Generate release manifest from Docker image
run: |
# Extract first tag from metadata output
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
echo "Generating manifest from image: $IMAGE_TAG"
# Pull the image we just built
docker pull --platform linux/amd64 "$IMAGE_TAG"
# Generate manifest from the Docker image
docker run --rm "$IMAGE_TAG" release-manifest > release-manifest.json
cat release-manifest.json
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${{ github.ref_name }}"
VERSION_NUMBER="${VERSION#v}"
# Extract the section for this version from CHANGELOG.md
# Start from the version header and continue until the next version header or end of file
CHANGELOG_SECTION=$(awk "/^## \[$VERSION_NUMBER\]/, /^## \[/ { if (/^## \[/ && !/^## \[$VERSION_NUMBER\]/) exit; print }" CHANGELOG.md | head -n -1)
# If no changelog section found, use a default message
if [ -z "$CHANGELOG_SECTION" ]; then
CHANGELOG_SECTION="See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.md) for details."
fi
# Write to file to avoid issues with multiline content
echo "$CHANGELOG_SECTION" > changelog_section.md
cat changelog_section.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body_path: changelog_section.md
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
- name: Upload release manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-manifest.json
asset_name: release-manifest.json
asset_content_type: application/json