-
Notifications
You must be signed in to change notification settings - Fork 21
48 lines (41 loc) · 1.65 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Publish to PyPI
on:
release:
types: [published]
jobs:
# Publish the package to PyPI https://pypi.org
pypi-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Check version correctness
run: |
python3 .github/check_version.py --branch ${{ github.event.release.target_commitish }} --tag $GITHUB_REF_NAME \
--new_version $(< VERSION) --old_version $(git cat-file -p $(git rev-parse "$GITHUB_SHA"^1):VERSION) \
--pre_release ${{ github.event.release.prerelease }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install build twine
- name: Build and publish to PyPI
if: ${{ success() }} # publish only when version passed the checks
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m build -w
twine check dist/*
twine upload --repository pypi dist/*
- name: Push to dockerhub
if: ${{ success() }}
run: |
docker build -f docker/Dockerfile -t dedocproject/dedoc:$GITHUB_REF_NAME .
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker tag dedocproject/dedoc:$GITHUB_REF_NAME dedocproject/dedoc:latest
docker push dedocproject/dedoc:$GITHUB_REF_NAME
docker push dedocproject/dedoc:latest