Skip to content

0.3.0

0.3.0 #30

Workflow file for this run

name: Release
on:
push:
branches:
- "main"
release:
types: [published]
workflow_dispatch:
jobs:
release:
env:
POETRY_VERSION: "1.3.2"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Python package version (tag)
if: github.ref_type == 'tag'
run: echo 'PYTHON_PACKAGE_VERSION=${{ github.ref_name }}' >> ${GITHUB_ENV}
- name: Python package version (branch)
if: github.ref_type != 'tag'
run: echo 'PYTHON_PACKAGE_VERSION=0.0.0.dev' >> ${GITHUB_ENV}
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Poetry env
run: echo "POETRY_HOME=${{ runner.temp }}/.poetry" >> ${GITHUB_ENV}
- name: Poetry path
run: echo "${POETRY_HOME}/bin" >> ${GITHUB_PATH}
- name: Install Poetry
run: |
set -x \
&& python -m venv "${POETRY_HOME}" \
&& "${POETRY_HOME}/bin/pip" install -U pip wheel setuptools \
&& "${POETRY_HOME}/bin/pip" install "poetry==${POETRY_VERSION}"
- run: poetry version "${PYTHON_PACKAGE_VERSION}"
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/wg-wizard
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
type=ref,event=branch
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=pep440,pattern={{major}}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and publish the PyPI package
if: github.ref_type == 'tag'
run: POETRY_PYPI_TOKEN_PYPI='${{ secrets.PYPI_TOKEN }}' poetry publish --build