Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
23 changes: 23 additions & 0 deletions .github/workflows/dependabot-auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dependabot auto-merge

on:
pull_request:

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
name: Auto-merge minor/patch
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-24.04
steps:
- uses: dependabot/fetch-metadata@v2
id: metadata

- if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge "$PR" --auto --squash
env:
PR: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ github.token }}
32 changes: 32 additions & 0 deletions .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR Title

on:
push:
branches: ["release-please--**"]
pull_request:
types: [opened, edited, reopened]

jobs:
validate:
name: Validate conventional commit
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@v6
with:
types: |
feat
fix
refactor
test
docs
chore
ci
build
perf
revert
style
env:
GITHUB_TOKEN: ${{ github.token }}
121 changes: 121 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Publish

on:
push:
tags: ["v*"]
workflow_call:
inputs:
tag:
required: true
type: string

env:
PYTHON_VERSION: "3.11"

jobs:
test:
name: Run tests
uses: ./.github/workflows/tests.yaml

build:
name: Build package
needs: test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.tag || github.ref_name }}
fetch-depth: 0

- uses: astral-sh/setup-uv@v7
with:
version: "0.10.9"
enable-cache: true

- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Build package
run: uv build

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7

publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/p/flixopt
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true

verify-pypi:
name: Verify PyPI installation
needs: publish-pypi
runs-on: ubuntu-24.04
steps:
- uses: astral-sh/setup-uv@v7
with:
version: "0.10.9"

- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Verify installation
run: |
VERSION="${TAG#v}"

for delay in 30 60 90 120 180 300; do
sleep $delay
echo "Attempting installation (waited ${delay}s)..."

if uv pip install --system --index-url https://pypi.org/simple/ "flixopt==$VERSION" && \
python -c "from importlib.metadata import version; assert version('flixopt') == '$VERSION'"; then
echo "PyPI installation successful!"
exit 0
fi
done

echo "Failed to verify PyPI installation"
exit 1
env:
TAG: ${{ inputs.tag || github.ref_name }}

github-release:
name: Create GitHub release
# Only on tag push — release-please creates its own release via workflow_call
if: github.event_name == 'push'
needs: verify-pypi
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v6

- name: Create GitHub release
run: |
if [[ "$TAG" =~ (rc|alpha|beta) ]]; then
gh release create "$TAG" --generate-notes --prerelease
else
gh release create "$TAG" --generate-notes
fi
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
Loading
Loading