Skip to content

chore: Release 2.24.1 #222

chore: Release 2.24.1

chore: Release 2.24.1 #222

Workflow file for this run

name: Release
on:
push:
tags:
- "*"
defaults:
run:
# make sure to work on Windows
shell: bash
jobs:
release-pypi:
name: release-pypi
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Check prerelease
id: check_version
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/[0-9.]+$ ]]; then
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
else
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Build artifacts
run: |
pipx run build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pdm-wheel
path: dist/*.whl
if-no-files-found: error
retention-days: 15
- name: Test Build
run: |
python -m pip install "pdm[locked] @ file://$(ls ${GITHUB_WORKSPACE}/dist/*.whl)"
pdm --help
- name: Publish package distributions to PyPI
run: pdm publish --no-build
- name: Get Changelog
id: get-changelog
run: |
awk '/## Release/{if (flag==1)exit;else;flag=1;next} flag' CHANGELOG.md > .changelog.md
- name: Create Release
uses: actions/create-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: v${{ github.ref }}
body_path: .changelog.md
draft: false
prerelease: ${{ steps.check_version.outputs.PRERELEASE }}
- name: Trigger Bucket Update
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Excavator
repo: frostming/scoop-frostming
token: ${{ secrets.G_T }}
ref: master
binary:
needs: release-pypi
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "ubuntu-22.04-arm", "windows-2022", "macos-13", "macos-14"]
env:
PYAPP_REPO: pyapp
PYAPP_VERSION: "0.27.0"
PYAPP_PROJECT_NAME: pdm
PYAPP_PROJECT_VERSION: ${{ github.ref_name }}
PYAPP_SELF_COMMAND: app # since `self` has been taken in `pdm`
PYAPP_DISTRIBUTION_EMBED: true
PYAPP_PROJECT_FEATURES: locked
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
SOURCE_FILE: ${{ matrix.os != 'windows-2022' && 'pyapp' || 'pyapp.exe' }}
TARGET_FILE: ${{ matrix.os != 'windows-2022' && 'pdm' || 'pdm.exe' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch PyApp
run: >-
mkdir $PYAPP_REPO && curl -L
https://github.com/ofek/pyapp/releases/download/v$PYAPP_VERSION/source.tar.gz
|
tar --strip-components=1 -xzf - -C $PYAPP_REPO
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: pdm-wheel
path: dist
- name: Configure embedded wheel
run: |
cd dist
wheel="$(echo *.whl)"
mv $wheel ../$PYAPP_REPO
echo "PYAPP_PROJECT_PATH=$wheel" >> $GITHUB_ENV
echo "TARGET_TRIPLE=$(rustc --version --verbose | grep "host" | awk '{print $2}')" >> $GITHUB_ENV
- name: Build
run: |
cd $PYAPP_REPO
cargo build --release
mv target/release/$SOURCE_FILE ../$TARGET_FILE
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: pdm-${{ github.ref_name }}-${{ env.TARGET_TRIPLE }}
path: ${{ env.TARGET_FILE }}
if-no-files-found: error
retention-days: 15
- name: Upload to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOAD_FILE: pdm-${{ github.ref_name }}-${{ env.TARGET_TRIPLE }}.tar.gz
run: |
tar -czf $UPLOAD_FILE $TARGET_FILE
gh release upload ${{ github.ref_name }} $UPLOAD_FILE --clobber