-
-
Notifications
You must be signed in to change notification settings - Fork 8
131 lines (128 loc) · 4.83 KB
/
release.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
122
123
124
125
126
127
128
129
130
131
name: Release
on:
release:
types:
- published
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
pages-build:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: '3.12'
version: 2.19.3
- run: env | sort
- run: make dev-doc
- run: make doc
- name: Upload pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: public
pages:
needs:
- pages-build
permissions:
id-token: write
pages: write
runs-on: ubuntu-24.04
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
container-publish:
permissions:
packages: write
runs-on: ubuntu-24.04
steps:
- run: env | sort
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up authentication
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Set up BuildKit
run: |
docker context create builder
docker buildx create builder --name container --driver docker-container --use
docker buildx inspect --bootstrap --builder container
- name: Build the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target dev
- name: Test the dev container
run: |
docker run --rm \
-e CI=true \
-v ${PWD}:/workspace \
ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
make dev lint test doc build
- name: Build the prod container
run: |
docker buildx build . \
--build-arg SCM_VERSION=${{ github.ref_name }} \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target prod
- name: Test the prod container
run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}
- name: Push the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-to type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max \
--file .devcontainer/Dockerfile \
--push \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target dev
- name: Push the prod container
run: |
docker buildx build . \
--build-arg SCM_VERSION=${{ github.ref_name }} \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--push \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}-${{ github.ref_name }} \
--target prod
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
package-publish:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: '3.12'
version: 2.19.3
- run: env | sort
- env:
PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }}
PDM_PUBLISH_USERNAME: ${{ vars.PDM_PUBLISH_USERNAME || '__token__' }}
run: make publish