1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
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@v5.0.0
- uses: actions/setup-python@v6
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@v5.0.0
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.2.4
with:
workflow: Excavator
repo: frostming/scoop-frostming
token: ${{ secrets.G_T }}
ref: master
binary:
needs: release-pypi
outputs:
checksums: ${{ steps.collect-checksums.outputs.checksums-json }}
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@v5.0.0
- 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/sccache-action@v0.0.9
- name: Download artifacts
uses: actions/download-artifact@v6.0.0
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@v5.0.0
with:
name: pdm-${{ github.ref_name }}-${{ env.TARGET_TRIPLE }}
path: ${{ env.TARGET_FILE }}
if-no-files-found: error
retention-days: 15
- name: Create and Upload Archive with Checksum
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOAD_FILE: pdm-${{ github.ref_name }}-${{ env.TARGET_TRIPLE }}.tar.gz
CHECKSUM_FILE: pdm-${{ github.ref_name }}-${{ env.TARGET_TRIPLE }}.tar.gz.sha256
run: |
tar -czf $UPLOAD_FILE $TARGET_FILE
sha256sum $UPLOAD_FILE > $CHECKSUM_FILE
gh release upload ${{ github.ref_name }} $UPLOAD_FILE $CHECKSUM_FILE --clobber
|