Skip to content

CD

CD #144

Workflow file for this run

name: CD
on:
workflow_dispatch:
release:
types:
- published
schedule:
- cron: "0 0 * * 1"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
CIBW_BUILD_VERBOSITY: 2
CIBW_BUILD_FRONTEND: "build"
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "pp* *musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
jobs:
sdist:
name: sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: 3.12
- name: Build source distribution
run: pipx run build --sdist --outdir dist/
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: source_distribution
path: dist
if-no-files-found: error
windows_amd64_wheels:
name: amd64-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23.0"
cache: false
- name: Install MinGW compiler(s)
run: choco install mingw
- uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_WINDOWS: AMD64
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_windows_amd64
path: ./wheelhouse/*.whl
if-no-files-found: error
windows_arm64_wheels: # Not tested
name: arm64-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23.0"
cache: false
check-latest: true
- uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0
with:
version: 0.13.0
- name: Build binary distribution (wheel) on Windows (arm64)
# We need to use cibuildwheel because it has experimental support for cross-compiling
# to arm64 and setup-python does not have arm64 support on Windows right now
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
# Cross-compile for arm64 target via Zig toolchain
env:
GOARCH: arm64
# We are on Windows amd64, so set target as arm64
CC: zig cc -target aarch64-windows-gnu
CXX: zig c++ -target aarch64-windows-gnu
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_WINDOWS: ARM64
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_SKIP: "*-win_arm64"
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_windows_arm64
path: ./wheelhouse/*.whl
if-no-files-found: error
windows_i686_wheels:
name: i686-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23.0"
cache: false
- uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0
with:
version: 0.13.0
# Note: cibuildwheel will manage installing 32-bit Python on Windows. We
# do not need to do that manually unless we use setup-python instead.
- name: Build binary distribution (wheel) on Windows (i686)
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
# Cross-compile for i686 target via Zig toolchain
env:
GOARCH: 386
CC: zig cc -target x86-windows-gnu
CXX: zig c++ -target x86-windows-gnu
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_WINDOWS: x86
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_windows_i686
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_amd64_wheels:
name: amd64-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.0.linux-amd64.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_linux_amd64
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_arm64_wheels:
name: arm64-manylinux
runs-on: buildjet-2vcpu-ubuntu-2204-arm
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: all
- uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: aarch64
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.0.linux-arm64.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_linux_aarch64
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_s390x_wheels:
name: s390x-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: all
- name: Build binary distribution (wheel) on Linux (s390x)
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: s390x
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.0.linux-s390x.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_linux_s390x
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_ppc64le_wheels:
name: ppc64le-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: all
- name: Build binary distribution (wheel) on Linux (ppc64le)
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: ppc64le
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.0.linux-ppc64le.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_linux_ppc64le
path: ./wheelhouse/*.whl
if-no-files-found: error
macos_amd64_wheels:
name: amd64-macos
runs-on: macos-13
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23.0"
cache: false
check-latest: true
- uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: x86_64
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_macos_x86_64
path: ./wheelhouse/*.whl
if-no-files-found: error
macos_arm64_wheels:
name: arm64-macos
runs-on: macos-14
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23.0"
cache: false
check-latest: true
- uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: arm64
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: wheels_macos_arm64
path: ./wheelhouse/*.whl
if-no-files-found: error
publish:
needs:
[
sdist,
windows_amd64_wheels,
windows_arm64_wheels,
windows_i686_wheels,
macos_amd64_wheels,
macos_arm64_wheels,
linux_amd64_wheels,
linux_arm64_wheels,
linux_s390x_wheels,
linux_ppc64le_wheels,
]
name: Publish to PyPI or TestPyPI
environment: release
permissions:
# Required by OIDC to publish to PyPI and by Sigstore to sign artifacts
id-token: write
# Required to upload artifacts to a GitHub release identifier
contents: write
# For GHA Attestations
attestations: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download all artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: upload/
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2
if: github.event_name == 'release' && github.event.action == 'published'
with:
# Comment this line out to publish to PyPI
# repository-url: https://test.pypi.org/legacy/
packages-dir: upload
- name: Sign artifacts with Sigstore
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0
with:
inputs: >-
./upload/*.whl
./upload/*.tar.gz
- name: Generate artifact attestation(s)
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
with:
subject-path: |
upload/*.whl
upload/*.tar.gz
- name: Publish to GitHub Releases
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
if: github.event_name == 'release' && github.event.action == 'published'
with:
# This will contain not only the wheel and sdist, but also the signature files
# generated by the Sigstore action
files: upload/*