This repository has been archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (93 loc) · 3.06 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
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
105
106
107
108
name: Publish
on:
push:
branches: [main]
tags: ["v*"]
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-docker-images:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up context
id: project_context
uses: FranzDiebold/[email protected]
- name: Extract metadata (tags, labels) for Docker
id: docker_metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }},${{ github.repository }}
tags: |
type=raw,value=nightly
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.vendor=OKP4
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_REGISTRY_ID }}
password: ${{ secrets.DOCKER_HUB_REGISTRY_TOKEN }}
- name: Build and publish image(s)
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
dockerhub-description:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Find change in readme file
id: readme-change
uses: tj-actions/changed-files@v34
with:
files: |
README.md
- name: Docker Hub Description
if: steps.readme-change.outputs.any_changed == 'true'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_HUB_REGISTRY_ID }}
short-description: Docker image for https://github.com/${{ github.repository }}
password: ${{ secrets.DOCKER_HUB_REGISTRY_TOKEN }}
repository: ${{ github.repository }}
readme-filepath: README.md
publish-pypi:
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up context
id: project_context
uses: FranzDiebold/[email protected]
- uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install Python Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.3.1
- name: Publish package
working-directory: ${{env.WORK_DIR}}
run: |
poetry install
poetry build
echo "🚀 Publishing pypi package"
poetry publish -u __token__ -p "${{ secrets.PYPI_API_TOKEN }}"