Skip to content

👷 dumb PyPI on GH pages #9

👷 dumb PyPI on GH pages

👷 dumb PyPI on GH pages #9

---
# 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: '11'
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.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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@v4
- 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@v4
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@v4
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@v4
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'