chore(deps-dev): bump black from 24.8.0 to 24.10.0 (#304) #158
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: Create Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
PYTHON_VERSION: "3.10" | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# Add repo secrets (DISCUSSION_REPO_ID & DISCUSSION_CATEGORY_ID) | |
# https://github.com/marketplace/actions/create-github-discussion#obtaining-the-repository-id-and-category-id | |
jobs: | |
version: | |
name: Generate version and tag | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }} | |
MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }} #TODO: Update to use valid python versions | |
Major: ${{ steps.gitversion.outputs.Major }} | |
Minor: ${{ steps.gitversion.outputs.Minor }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Use GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Create annotation for build error | |
run: | | |
echo "::notice::FullSemVer ${{ steps.gitversion.outputs.FullSemVer }}" | |
echo "::notice::MajorMinorPatch ${{ steps.gitversion.outputs.MajorMinorPatch }}" | |
echo "::notice::Major ${{ steps.gitversion.outputs.Major }}" | |
echo "::notice::Minor ${{ steps.gitversion.outputs.Minor }}" | |
- name: Bump version and push tag # https://github.com/marketplace/actions/github-tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ steps.gitversion.outputs.FullSemVer }} | |
tag_prefix: v | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
contents: write | |
discussions: write | |
needs: [version] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 # https://github.com/marketplace/actions/setup-python | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.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: Version package | |
run: poetry version ${{ needs.version.outputs.MajorMinorPatch }} | |
- name: Build package | |
run: poetry build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
- name: Create Release | |
uses: softprops/[email protected] # https://github.com/marketplace/actions/gh-release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: v${{ needs.version.outputs.FullSemVer }} | |
discussion_category_name: Announcements | |
generate_release_notes: true | |
docker: | |
name: Docker Build and Push | |
runs-on: ubuntu-latest | |
environment: release | |
needs: [version] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry # https://github.com/marketplace/actions/docker-login | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push # https://github.com/marketplace/actions/build-and-push-docker-images | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
${{ github.ref == 'refs/heads/main' && env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.Major }} | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.Major }}.${{ needs.version.outputs.Minor }} | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.MajorMinorPatch }} | |
build-args: | | |
VERSION=${{ needs.version.outputs.MajorMinorPatch }} |