-
Notifications
You must be signed in to change notification settings - Fork 8
121 lines (103 loc) · 3.55 KB
/
publish-release-to-pypi.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
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Publish release to PyPi
on:
release:
types: [published]
jobs:
build-wheel-and-tarball:
runs-on: ubuntu-latest
name: Build Logprep
steps:
- uses: actions/checkout@v4
- name: Initialize Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Build binary wheel and a source tarball
run: pip wheel --no-deps --wheel-dir ./dist .
- name: Upload Artifact for next job
uses: actions/upload-artifact@master
with:
name: logprep-build
path: dist
publish-latest-release-to-pypi:
runs-on: ubuntu-latest
name: Publish release to PyPi
environment:
name: pypi
url: https://pypi.org/p/logprep
permissions:
id-token: write
needs: build-wheel-and-tarball
steps:
- name: Download artifact from previous job
uses: actions/download-artifact@master
with:
name: logprep-build
path: dist
- name: Publish package distributions to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
containerbuild:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12.3"]
runs-on: ubuntu-latest
needs: publish-latest-release-to-pypi
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images
uses: docker/build-push-action@v3
with:
context: .
push: true # Will only build if this is not here
build-args: |
LOGPREP_VERSION=${{ github.ref_name }}
PYTHON_VERSION=${{ matrix.python-version }}
tags: |
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-${{ github.ref_name }}
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-stable
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-latest
helm-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: template Chart.yaml
env:
LOGPREP_VERSION: ${{ github.ref_name }}
run: |
sed "s/{{ LOGPREP_VERSION }}/$LOGPREP_VERSION/g" charts/logprep/Chart.yaml.j2 > ./charts/logprep/Chart.yaml
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update Logprep chart versions
# Optional glob pattern of files which should be added to the commit
# Defaults to all (.)
# See the `pathspec`-documentation for git
# - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203
# - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
file_pattern: "charts/logprep/Chart.yaml"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"