-
Notifications
You must be signed in to change notification settings - Fork 5
104 lines (84 loc) · 2.64 KB
/
release.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release Package
on:
release:
types: [published]
workflow_dispatch:
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Library
run: |
python -m pip install .
python -m pip install setuptools
- id: get_version
uses: battila7/get-version-action@v2
- name: Check version
run: |
LIBRARY_VERSION=$(unassign --version)
GITHUB_VERSION=${{ steps.get_version.outputs.version-without-v }}
if [[ $LIBRARY_VERSION == $GITHUB_VERSION ]]; then
echo "Versions match, continuing..."
else
echo "Versions don't match, exiting..."
echo "Library version: $LIBRARY_VERSION"
echo "GitHub version: $GITHUB_VERSION"
exit 1
fi
run-tests:
uses: ./.github/workflows/test.yml
secrets: inherit
build-and-publish-to-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [run-tests, check-version]
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
build-and-push-to-dockerhub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: [run-tests, check-version]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ctbushman/unassigner
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}