-
-
Notifications
You must be signed in to change notification settings - Fork 98
77 lines (75 loc) · 2.66 KB
/
publish.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Publishing
on:
release:
types:
- published
concurrency:
group: ${{ github.workflow }}
jobs:
pypi-publish:
name: PyPI
if: github.repository_owner == 'juftin'
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Hatch
run: |
python -m pip install --upgrade pip
python -m pip install -q hatch
hatch env create
hatch --version
- name: Build package
run: |
hatch build
- name: Publish package on PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
docker-hub-publish:
name: docker-hub
if: github.repository_owner == 'juftin'
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Hatch
run: |
python -m pip install --upgrade pip
python -m pip install -q hatch
hatch env create
hatch --version
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Declare Version Variable
run: |
PACKAGE_VERSION=$(hatch version)
PACKAGE_NAME=$(hatch project metadata | jq -r .name)
echo PACKAGE_VERSION=${PACKAGE_VERSION} >> $GITHUB_ENV
echo PACKAGE_NAME=${PACKAGE_NAME} >> $GITHUB_ENV
- name: Docker Image Building and Publishing
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: juftin/${{ env.PACKAGE_NAME }}:latest,juftin/${{ env.PACKAGE_NAME }}:${{ env.PACKAGE_VERSION }}