-
Notifications
You must be signed in to change notification settings - Fork 1
31 lines (31 loc) · 1.15 KB
/
deploy.yml
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
name: Deploy
on:
push:
branches: [main]
jobs:
deploy-package-next:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: package
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
# NOTE(krishan711): need full history to calculate difference
fetch-depth: 0
- name: Build docker image
run: docker build --tag $DOCKER_IMAGE .
- name: Calculate commit count since last tag
id: vars
run: echo ::set-output name=commit_count::$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
- name: Create .pypirc file
run: echo -e "[pypi]\nusername=__token__\npassword=$PYPI_TOKEN" > .pypirc
- name: Publish next package to pypi
if: steps.vars.outputs.commit_count != '0'
run: |
docker run -v $(pwd)/.pypirc:/root/.pypirc $DOCKER_IMAGE /bin/bash -c " \
python buildpy/version.py --part dev --count ${{ steps.vars.outputs.commit_count }} \
&& python setup.py bdist_wheel \
&& twine upload --non-interactive --disable-progress-bar dist/* \
"