Skip to content

feat: build_and_publish ci workflow #1

feat: build_and_publish ci workflow

feat: build_and_publish ci workflow #1

name: Build and Publish
on: push
permissions:
contents: write
jobs:
build-extension:
runs-on: ubuntu-24.04
env:
VERSION: ""
SHORT_COMMIT: ""
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install package
run: pip install .
- name: Extract commit metadata
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "SHORT_COMMIT=$(echo ${GITHUB_SHA} | cut -c1-6)" >> $GITHUB_ENV
- name: Build
run: |
pip install build
python3 -m build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ env.SHORT_COMMIT }}
path: dist/
retention-days: 7
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ env.VERSION }}
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}