Skip to content

chore(deps): bump softprops/action-gh-release from 2.0.4 to 2.0.6 (#260) #128

chore(deps): bump softprops/action-gh-release from 2.0.4 to 2.0.6 (#260)

chore(deps): bump softprops/action-gh-release from 2.0.4 to 2.0.6 (#260) #128

Workflow file for this run

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/setup@v1.1.1
with:
versionSpec: "5.x"
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v1.1.1
- 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/github-tag-action@v6.2
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/action-gh-release@v2.0.6 # 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@v5
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 }}