v1.17.7 #96
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Release | |
'on': | |
release: | |
types: [published] | |
permissions: | |
contents: read # required for github.ref to be set | |
jobs: | |
pypi: | |
name: Publish release on PyPI | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout alibuild | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install build dependencies # needed by our setup.py | |
run: python -m pip install setuptools | |
- name: Build the Python distribution | |
run: python setup.py sdist | |
- name: Publish distribution to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
brew: | |
name: Update Homebrew formula | |
needs: pypi | |
runs-on: macos-latest | |
if: startsWith(github.ref, 'refs/tags/') && !github.event.release.prerelease | |
steps: | |
- name: Install prerequisites | |
run: brew install pipgrip | |
- name: Checkout Homebrew repo | |
run: brew tap alisw/system-deps | |
- name: Update alibuild formula with new version | |
run: | | |
set -x | |
json=$(curl -fSsL "https://pypi.org/pypi/alibuild/${GITHUB_REF#refs/tags/}/json") | |
sha=$(echo "$json" | jq -r '.urls[0].digests.sha256') | |
url=$(echo "$json" | jq -r '.urls[0].url') | |
# Replace keys with two leading spaces only, so we get the toplevel | |
# ones applying to alibuild, not those for dependencies. | |
sed -i.bak " | |
s|^ url .*| url \"$url\"|; | |
s|^ sha256 .*| sha256 \"$sha\"|; | |
s|^ version .*| version \"${GITHUB_REF#refs/tags/v}\"| | |
" "$(brew formula alibuild)" | |
rm -f "$(brew formula alibuild).bak" | |
- name: Regenerate alibuild formula | |
run: | | |
set -x | |
# Sometimes, brew update-python-resources apparently randomly fails, | |
# blaming pipgrip. Retries should hopefully solve this. | |
attempt=0 | |
while [ $((attempt++)) -lt 5 ]; do | |
echo "Attempt $attempt/5..." >&2 | |
brew update-python-resources alibuild && break | |
sleep 300 | |
done | |
- name: Push updated formula | |
run: | | |
set -x | |
cd "$(dirname "$(brew formula alibuild)")" | |
git config user.name alibuild | |
git config user.email '[email protected]' | |
git add alibuild.rb | |
git commit -m "Update alibuild to ${GITHUB_REF#refs/tags/}" | |
git show | |
git push "https://alibuild:[email protected]/alisw/homebrew-system-deps" master | |
env: | |
GITHUB_TOKEN: ${{ secrets.homebrew_repo_token }} |