Skip to content

Commit

Permalink
Add workflow for building and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Oct 6, 2024
1 parent 25fbe7b commit ec5b262
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Publish

on:
push:
tags:
- 'v*'
branches:
- main
pull_request:
branches:
- main
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.17

- name: Set up PDM
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4.1
with:
python-version: '3.11'

- name: Install dependencies
run: |
pdm sync --prod
- name: Build distributions
run: |
pdm build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: dist/

publish:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: build-artifacts

- name: Publish to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.whl
dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify Release
run: |
echo "Published release for tag ${{ github.ref }}."

0 comments on commit ec5b262

Please sign in to comment.