-
Notifications
You must be signed in to change notification settings - Fork 3
144 lines (136 loc) · 4.03 KB
/
Copy pathworkflow.yml
File metadata and controls
144 lines (136 loc) · 4.03 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build docker image
on:
push:
branches:
- master
tags:
- '*'
- '!*-r[0-9]*'
pull_request:
env:
PYTHON314: '3.14.8'
PYTHON313: '3.13.16'
PYTHON312: '3.12.15'
PYTHON311: '3.11.17'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.set-matrix.outputs.python-versions }}
steps:
- id: set-matrix
run: |
cat << 'EOF' > versions.json
[
{"key": "python314", "version": "${{ env.PYTHON314 }}", "latest": "latest", "latest_major": "3"},
{"key": "python313", "version": "${{ env.PYTHON313 }}", "latest": "", "latest_major": ""},
{"key": "python312", "version": "${{ env.PYTHON312 }}", "latest": "", "latest_major": ""},
{"key": "python311", "version": "${{ env.PYTHON311 }}", "latest": "", "latest_major": ""}
]
EOF
echo "python-versions=$(cat versions.json | jq -c .)" >> $GITHUB_OUTPUT
build:
needs: setup
strategy:
fail-fast: false
matrix:
python: ${{ fromJson(needs.setup.outputs.python-versions) }}
arch:
- amd64
- arm64
dev:
- ''
- 'dev'
user_id:
- 1000
- 501
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
- user_id: 501
group_id: 20
dev: dev
exclude:
- dev: ''
user_id: 501
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Build and test
id: build-image
env:
PYTHON_VER: ${{ matrix.python.version }}
ARCH: ${{ matrix.arch }}
PYTHON_DEV: ${{ matrix.dev }}
WODBY_USER_ID: ${{ matrix.user_id }}
WODBY_GROUP_ID: ${{ matrix.group_id }}
run: |
make
make test
echo "image=$(make --no-print-directory -s image-ref)" >> "$GITHUB_OUTPUT"
- name: Scan image
uses: ./.github/actions/grype
with:
image: docker:${{ steps.build-image.outputs.image }}
- uses: docker/login-action@v3
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push architecture image
if: github.event_name == 'push'
env:
PYTHON_VER: ${{ matrix.python.version }}
ARCH: ${{ matrix.arch }}
PYTHON_DEV: ${{ matrix.dev }}
WODBY_USER_ID: ${{ matrix.user_id }}
WODBY_GROUP_ID: ${{ matrix.group_id }}
run: make push
push:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- setup
- build
strategy:
matrix:
python: ${{ fromJson(needs.setup.outputs.python-versions) }}
dev:
- ''
- 'dev'
user_id:
- 1000
- 501
exclude:
- dev: ''
user_id: 501
steps:
- uses: actions/checkout@v6
- uses: docker/login-action@v3
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: ./.github/actions
with:
version: ${{ matrix.python.version }}
dev: ${{ matrix.dev }}
user_id: ${{ matrix.user_id }}
latest: ${{ matrix.python.latest }}
latest_major: ${{ matrix.python.latest_major }}
image-revision-aliases:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/r')
needs: [ push ]
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: image-revision-aliases-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: wodby/images/.github/actions/image-revision-aliases@412e2d9ce29c41835ff653b0945bba72eabd9efb
with:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}