Skip to content

Commit

Permalink
Add dependabot and a simple build/publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Sep 19, 2024
1 parent 5bc7f99 commit a549792
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# Open update PRs in groups rather than one-by-one
groups:
actions:
patterns:
- "*"
55 changes: 55 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and upload to PyPI

on:
# Allow manual triggering of the workflow, but note that the upload
# to PyPI step will not run manual trigger.
workflow_dispatch:
# Run workflow on pullrequests, but note that the upload to PyPI step
# will not run on pull requests.
pull_request:
# Run workflow on push to main branch, but note that the upload to
# PyPI step will not run on pushes. We could change that if we wanted
# to have it publish on tags -- see the upload_pypi job below.
push:
branches:
- main
# Run workflow on GitHub release done through the UI -- this is the only
# time the upload to PyPI step will run.
release:
types:
- published

jobs:
build_wheel_sdist:
name: Build wheel and sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build wheel and sdist
run: pipx run build

- uses: actions/upload-artifact@v4
with:
name: wheel-sdist
path: dist/*

upload_pypi:
needs: [build_wheel_sdist]
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: wheel-sdist
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit a549792

Please sign in to comment.