-
Notifications
You must be signed in to change notification settings - Fork 31
200 lines (179 loc) · 6.09 KB
/
build-dumb-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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
name: 👷 dumb PyPI on GH pages
env:
ANSIBLE_MAJOR_VERSION: '8'
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
ansible-core-slug:
default: ansible/ansible
description: The GitHub repo slug for pulling ansible-core from
required: true
ansible-core-ref:
default: devel
description: The GitHub repo ref for pulling ansible-core from
required: true
ansible-build-data-slug:
default: ansible-community/ansible-build-data
description: The GitHub repo slug for pulling ansible build data from
required: true
ansible-build-data-ref:
default: main
description: The GitHub repo ref for pulling ansible build data from
required: true
# Run once per week (Monday at 04:00 UTC)
schedule:
- cron: '0 4 * * 1'
jobs:
build-dumb-pypi:
name: ansible-core and ansible 🌃
runs-on: ubuntu-latest
steps:
- name: Switch to Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Figure out the source repos
id: build-settings
run: |
{
echo \
'ansible-core-slug=${{
github.event_name == 'workflow_dispatch' &&
github.event.inputs.ansible-core-slug ||
'ansible/ansible'
}}'
echo \
'ansible-core-ref=${{
github.event_name == 'workflow_dispatch' &&
github.event.inputs.ansible-core-ref ||
'devel'
}}'
echo \
'ansible-build-data-slug=${{
github.event_name == 'workflow_dispatch' &&
github.event.inputs.ansible-build-data-slug ||
'ansible-community/ansible-build-data'
}}'
echo \
'ansible-build-data-ref=${{
github.event_name == 'workflow_dispatch' &&
github.event.inputs.ansible-build-data-ref ||
'main'
}}'
} >> ${GITHUB_OUTPUT}
- name: Check out antsibull
uses: actions/checkout@v3
- name: >-
Check out ${{
steps.build-settings.outputs.ansible-build-data-slug
}}@${{
steps.build-settings.outputs.ansible-build-data-ref
}} src from Git
uses: actions/checkout@v3
with:
path: ansible-build-data
ref: ${{ steps.build-settings.outputs.ansible-build-data-ref }}
repository: ${{ steps.build-settings.outputs.ansible-build-data-slug }}
- name: Make 'dist/' dir
run: |
from pathlib import Path
Path('dist').mkdir()
shell: python
- name: Install packaging-related dists from PyPI
run: >-
python -m
pip install
-U --user
pip setuptools wheel
- name: Install antsibull dist from PyPI
run: python -m pip install -U --user antsibull
- name: Install antsibull dist from GitHub
run: >-
python -m
pip install
-U --user
.
- name: Generate the list of compatible versions
run: >-
~/.local/bin/antsibull-build
new-ansible "${ANSIBLE_MAJOR_VERSION}.99.0"
--data-dir "ansible-build-data/${ANSIBLE_MAJOR_VERSION}"
- name: Prepare an Ansible dist
run: >-
~/.local/bin/antsibull-build
prepare "${ANSIBLE_MAJOR_VERSION}.99.0"
--data-dir "ansible-build-data/${ANSIBLE_MAJOR_VERSION}"
- name: Create a single-tarball Ansible dist
run: >-
~/.local/bin/antsibull-build
rebuild-single "${ANSIBLE_MAJOR_VERSION}.99.0"
--data-dir "ansible-build-data/${ANSIBLE_MAJOR_VERSION}"
--sdist-dir dist
- name: >-
Check out ${{
steps.build-settings.outputs.ansible-core-slug
}}@${{
steps.build-settings.outputs.ansible-core-ref
}} src from Git
uses: actions/checkout@v3
with:
path: ansible--ansible--devel
ref: ${{ steps.build-settings.outputs.ansible-core-ref }}
repository: ${{ steps.build-settings.outputs.ansible-core-slug }}
- name: >-
Build ${{
steps.build-settings.outputs.ansible-core-slug
}}@${{
steps.build-settings.outputs.ansible-core-ref
}}
run: |
python -m build --outdir=../dist
working-directory: ansible--ansible--devel
- name: Make ansible version stable
# FIXME: use setuptools-scm to generate the actual version?
run: >-
sed -i
"s/^\(__version__ = '\)\([0-9]\+.[0-9]\+.[0-9]\+\)\.\(dev\|a\|b\|rc\)[0-9]\+\('\)$/\1\2\4/g"
lib/ansible/release.py
working-directory: ansible--ansible--devel
- name: >-
Build ${{
steps.build-settings.outputs.ansible-core-slug
}}@${{
steps.build-settings.outputs.ansible-core-ref
}} as stable
run: |
python -m build --outdir=../dist
working-directory: ansible--ansible--devel
- name: Install dumb-pypi dist from PyPI
run: python -m pip install dumb-pypi --user
- name: Generate a dumb PyPI website
run: |
python -m dumb_pypi.main \
--package-list <(ls dist) \
--packages-url https://raw.githubusercontent.com/ansible-community/nightly-builds/gh-pages/dist \
--output-dir www
shell: bash
- name: Copy dists over to the generated dumb PyPI website dir
run: cp -av dist www/
- name: >-
Publish the dumb PyPI website to GH Pages
@
https://ansible-community.github.io/nightly-builds
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v3
with:
force_orphan: true
deploy_key: ${{ secrets.NIGHTLIES_DEPLOYMENT_KEY }}
external_repository: ansible-community/nightly-builds
publish_dir: www
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'