68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
name: Release
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Build and release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install `build` from pip
|
|
run: pip install build
|
|
|
|
- name: Build
|
|
run: python -m build
|
|
|
|
- name: Set GITHUB_RELEASE_TAG & ARTIFACT_ID
|
|
run: |
|
|
set -eux
|
|
if [[ '${{ github.ref }}' = refs/tags/v* ]]; then
|
|
tag='${{ github.ref }}'
|
|
tag="${tag:10}"
|
|
artifactID="${tag:1}"
|
|
else
|
|
tag=CI
|
|
artifactID='${{ github.sha }}'
|
|
artifactID="${artifactID:0:8}"
|
|
fi
|
|
echo "GITHUB_RELEASE_TAG=$tag" >> $GITHUB_ENV
|
|
echo "ARTIFACT_ID=$artifactID" >> $GITHUB_ENV
|
|
|
|
- name: Rename artifacts
|
|
run: |
|
|
mv dist/pumpkin_api_py-*-py3-none-any.whl dist/pumpkin_api_py-${ARTIFACT_ID}-py3-none-any.whl
|
|
mv dist/pumpkin_api_py-*.tar.gz dist/pumpkin_api_py-${ARTIFACT_ID}.tar.gz
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: python-dist
|
|
path: dist/pumpkin_api_py*
|
|
|
|
- name: Upload artifacts to release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.GITHUB_RELEASE_TAG }}
|
|
artifacts: dist/pumpkin_api_py*
|
|
allowUpdates: true
|
|
omitPrereleaseDuringUpdate: true
|
|
omitName: true
|
|
omitBody: true
|
|
omitDraftDuringUpdate: true
|
|
removeArtifacts: true
|