-
Notifications
You must be signed in to change notification settings - Fork 83
60 lines (52 loc) · 1.52 KB
/
publish.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
name: Upload Python Package and Docker Container
on:
push:
branches:
- main
release:
types:
- created
jobs:
deploy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Set __version__ and poetry version
if: github.event_name == 'release'
run: |
TAG="$(git describe --tags --abbrev=0)"
echo "__version__ = \"${TAG##*v}\"" > asu/__init__.py
poetry version "${TAG##*v}"
- name: Build and publish
if: github.event_name == 'release'
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: openwrt/asu
tags: |
type=semver,pattern={{version}}
latest
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push ASU to Docker Hub
uses: docker/build-push-action@v5
with:
file: Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}