Skip to content

add GHA job for publishing GitHub releases #9

add GHA job for publishing GitHub releases

add GHA job for publishing GitHub releases #9

Workflow file for this run

name: Build & Publish
on:
push:
branches:
- '**' # match all branches
tags:
- '*' # match all tags
pull_request:
workflow_dispatch:
permissions:
id-token: write
contents: write
jobs:
build:
name: Publish flet-geolocator package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history
fetch-tags: true # ensure tags are available
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Patch versions
run: |
source .github/scripts/update_build_version.sh
uv version $PYPI_VER
uv run .github/scripts/patch_pubspec_version.py src/flutter/*/pubspec.yaml $PKG_VER
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Analyze Flutter package
working-directory: src/flutter/flet_geolocator
run: |
dart pub get
dart analyze
- name: Build Python package
run: uv build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*.whl
- name: Filter publish-relevant changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
publish:
- 'src/**'
- 'pyproject.toml'
- 'README.md'
- name: Publish Python package
if: >
startsWith(github.ref, 'refs/tags/')
|| (github.event_name != 'pull_request' &&
github.ref == 'refs/heads/main' &&
steps.changes.outputs.publish == 'true')
run: uv publish
release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Create/Update GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: dist/*.whl
generate_release_notes: true
preserve_order: true
overwrite_files: true
fail_on_unmatched_files: true