Skip to content

ci: update config for python_semantic_release #45

ci: update config for python_semantic_release

ci: update config for python_semantic_release #45

Workflow file for this run

name: Release
on:
push:
branches:
- main
jobs:
bump-version:
name: Bump Version
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write
outputs:
released: ${{ steps.python-semantic-release.outputs.released }}
version: ${{ steps.python-semantic-release.outputs.version }}
commit_sha: ${{ steps.sha.outputs.new_sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python Semantic Release
id: python-semantic-release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Commit SHA
id: sha
run: |
new_sha=$(git rev-parse HEAD)
echo $new_sha
echo "new_sha=$new_sha" >> $GITHUB_OUTPUT
docker:
name: Docker Image
runs-on: ubuntu-latest
needs:
- bump-version
if: needs.bump-version.outputs.released == 'true'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.bump-version.outputs.commit_sha }}
- name: Parse semantic version
id: parse-semver
run: |
full_version=`echo ${{ needs.bump-version.outputs.version }}`
major_version=`echo $full_version | cut -d'.' -f1`
minor_version=`echo $full_version | cut -d'.' -f2`
major_minor=`echo $major_version.$minor_version`
echo "MAJOR_VERSION=$major_version" >> $GITHUB_OUTPUT
echo "MAJOR_MINOR=$major_minor" >> $GITHUB_OUTPUT
echo "FULL_VERSION=$full_version" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
${{ steps.parse-semver.outputs.FULL_VERSION }}
${{ steps.parse-semver.outputs.MAJOR_VERSION }}
${{ steps.parse-semver.outputs.MAJOR_MINOR }}
flavor: |
latest=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Update repo description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
short-description: ${{ github.event.repository.description }}