Skip to content

Release

Release #102

Workflow file for this run

name: Release
on:
push:
tags:
- v*
workflow_dispatch:
inputs: {}
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
jobs:
Build-Linux:
strategy:
matrix:
include:
- runner: ubuntu-latest
cibw_arch: aarch64
go_arch: arm64
- runner: ubuntu-latest
cibw_arch: x86_64
go_arch: amd64
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
env:
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: |
GO_VERSION=$(grep '^golang ' /project/.tool-versions | awk '{print $2}')
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${{ matrix.go_arch }}.tar.gz" \
| tar -C /usr/local -xz
CIBW_ENVIRONMENT_LINUX: PATH=/usr/local/go/bin:$PATH
- name: Upload Artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: wheels-linux-${{ matrix.cibw_arch }}
path: ./wheelhouse/*.whl
Build-Windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5
with:
go-version-file: ".tool-versions"
cache: true
cache-dependency-path: "gotfparse/go.sum"
- name: Build wheels
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
env:
CGO_ENABLED: 1
CIBW_ARCHS: AMD64
- name: Upload Artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: wheels-windows
path: ./wheelhouse/*.whl
Build-MacOS:
strategy:
matrix:
include:
- cibw_arch: "x86_64"
go_arch: "amd64"
- cibw_arch: "arm64"
go_arch: "arm64"
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5
with:
go-version-file: ".tool-versions"
cache: true
cache-dependency-path: "gotfparse/go.sum"
- name: Build wheels
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
env:
CGO_ENABLED: 1
CIBW_ARCHS: ${{ matrix.cibw_arch }}
GOARCH: ${{ matrix.go_arch }}
- name: Upload Artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: wheels-macos-${{ matrix.cibw_arch }}
path: ./wheelhouse/*.whl
Gather:
needs: [Build-Linux, Build-MacOS, Build-Windows]
runs-on: ubuntu-latest
outputs:
hash: ${{ steps.hash.outputs.hash }}
steps:
- name: Fetch Wheels
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
with:
pattern: "wheels-*"
path: dist
merge-multiple: true
- name: Display downloaded artifacts
run: ls -lh dist
- name: Generate Hashes
id: hash
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
Provenance:
needs: [Gather]
permissions:
actions: read
id-token: write
contents: write
# Can't pin with hash due to how this workflow works.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
with:
base64-subjects: ${{ needs.Gather.outputs.hash }}
Release:
runs-on: ubuntu-latest
needs: [Provenance]
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Fetch Wheels
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
with:
pattern: "*"
path: dist
merge-multiple: true
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ github.token }}
draft: false
generateReleaseNotes: true
Upload:
needs: [Release]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write
steps:
- name: Fetch Wheels
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
with:
pattern: "wheels-*"
path: dist
merge-multiple: true
- name: Upload to PYPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e