-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.49 KB
/
build-and-push.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
name: Build and push docker image and package
on:
release:
types:
- published
workflow_dispatch:
jobs:
build-and-push:
name: Build and push docker image
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/${{ github.repository }}
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: checkout code
uses: actions/checkout@v4
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: install poetry
run: |
python -m pip install --no-cache-dir poetry==1.8 supervisor
poetry self add "poetry-dynamic-versioning[plugin]"
- name: set up docker
run: |
make gha-setup
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build with Poetry
run: make build-wheel
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
ghcr.io/${{ github.repository }}:latest
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1