Publish release #3
Workflow file for this run
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: release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
publish-container-image: | |
name: "Publish container image to github registry" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get version | |
run: | | |
VERSION="${GITHUB_REF/refs\/tags\//}" | |
VERSION="${VERSION/v/}" | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Set version | |
run: | | |
sed -i "s|^version[\ ]*=.*|version = \"${VERSION}\"|g" pyproject.toml | |
- name: Build | |
run: | | |
docker build . -t ${GITHUB_REPOSITORY,,} | |
- name: Create tags | |
run: | | |
VERSIONS=(${VERSION//./ }) | |
TAGS=( | |
"latest" | |
${VERSIONS[0]} | |
${VERSIONS[0]}.${VERSIONS[1]} | |
${VERSIONS[0]}.${VERSIONS[1]}.${VERSIONS[2]} | |
) | |
echo "TAGS=${TAGS[@]}" >> $GITHUB_ENV | |
- name: Tagging | |
run: | | |
for TAG in ${TAGS}; do | |
docker tag ${GITHUB_REPOSITORY,,} ghcr.io/${GITHUB_REPOSITORY,,}:${TAG} | |
done | |
- name: Login into registry | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.repository_owner }} --password-stdin | |
- name: Push to image | |
run: | | |
for TAG in ${TAGS}; do | |
docker push ghcr.io/${GITHUB_REPOSITORY,,}:${TAG} | |
done | |
publish-python-package: | |
name: "Publish python package to pypi" | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version | |
run: | | |
VERSION="${GITHUB_REF/refs\/tags\//}" | |
VERSION="${VERSION/v/}" | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Set version | |
run: | | |
sed -i "s|^version[\ ]*=.*|version = \"${VERSION}\"|g" pyproject.toml | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.12" | |
- name: Install Poetry Action | |
uses: snok/[email protected] | |
with: | |
version: '1.8.3' | |
- name: Build package | |
run: | | |
poetry build | |
- name: pypi-publish | |
uses: pypa/[email protected] |