mirror of
https://github.com/koxudaxi/datamodel-code-generator.git
synced 2024-03-18 14:54:37 +03:00
69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
name: Publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '**'
|
|
|
|
jobs:
|
|
build-n-publish:
|
|
name: Build and publish Python 🐍 distributions 📦 to PyPI
|
|
if: "success() && startsWith(github.ref, 'refs/tags/')"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions/cache@v1
|
|
with:
|
|
path: |
|
|
~/.cache/pypoetry
|
|
~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.8
|
|
- name: Build publish
|
|
run: |
|
|
python -m pip install poetry poetry-dynamic-versioning
|
|
poetry install
|
|
poetry build
|
|
- name: Publish package
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.pypi_password }}
|
|
push_to_registry:
|
|
name: Push Docker image to Docker Hub
|
|
if: "success() && startsWith(github.ref, 'refs/tags/')"
|
|
runs-on: ubuntu-latest
|
|
needs: build-n-publish
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v2
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: crazy-max/ghaction-docker-meta@v1
|
|
with:
|
|
images: koxudaxi/datamodel-code-generator
|
|
tag-semver: |
|
|
{{raw}}
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: true
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
build-args: |
|
|
VERSION=${{ github.ref_name }}
|
|
platforms: linux/amd64,linux/arm64
|