pumpkin-api-py/.github/workflows/main.yml
2026-08-03 16:19:07 -07:00

76 lines
1.9 KiB
YAML

name: Main
on:
push:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
main:
name: Build, test, 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: Install built artifacts
run: pip install dist/*.whl
- name: Build example plugin to test
run: |
cd example
pumpkin-plugin-build main
- 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