Skip to content

Commit

Permalink
ci: workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
leocov-dev committed Oct 12, 2024
1 parent c4226da commit 50561f7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 48 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags-ignore:
- "*"

jobs:
test:
Expand Down
59 changes: 18 additions & 41 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Publish

on:
workflow_dispatch:
push:
branches:
- main
tags-ignore:
- "*"

jobs:


# -------------
release:
name: Create A Release
Expand All @@ -16,7 +19,7 @@ jobs:
id-token: write

outputs:
TAG: ${{ steps.semver.outputs.nextStrict }}
TAG: ${{ steps.semantic.outputs.tag }}

runs-on: ubuntu-latest
steps:
Expand All @@ -25,54 +28,28 @@ jobs:
# Personal Access Token enables git push in actions (repo contents permission)
token: ${{ secrets.PAT }}

- name: Calculate next version
id: semver
uses: ietf-tools/[email protected]
- name: Python Semantic Release
id: semantic
uses: python-semantic-release/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

- id: current
run: echo "version=$(pipx run hatch version | tr -d '\n')" >> $GITHUB_OUTPUT

- if: ${{ steps.current.outputs.version == steps.semver.outputs.nextStrict || !steps.current.outputs.version }}
run: exit 1

- name: Version Up
run: pipx run hatch version ${{ steps.semver.outputs.nextStrict }}

- name: Commit version change and tag
run: |
git config --global user.name 'GitHub Automation'
git config --global user.email 'automation[bot]@leocov.com'
git add src/pyside_app_core/__init__.py
git commit -m "chore(release): version up to: ${{ steps.semver.outputs.nextStrict }} [skip ci]"
git push
git tag ${{ steps.semver.outputs.nextStrict }}
git push --tags
github_token: ${{ secrets.GITHUB_TOKEN }}
build: false
tag: true
vcs_release: true
changelog: false

- name: Create Build
run: pipx run hatch build
run: pipx run hatch build -t wheel --clean

- name: Generate Build Signatures
uses: sigstore/[email protected]
with:
inputs: ./dist/*

- name: Generate Changelog
id: changelog
uses: requarks/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.semver.outputs.nextStrict }}
excludeScopes: "release"

- uses: ncipollo/release-action@v1
- name: Python Semantic Release - Publish
uses: python-semantic-release/[email protected]
with:
artifacts: "dist/*"
tag: ${{ steps.semver.outputs.nextStrict }}
name: "Release v${{ steps.semver.outputs.nextStrict }}"
body: ${{ steps.changelog.outputs.changelog }}

github_token: ${{ secrets.GITHUB_TOKEN }}

# -------------
pypi:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ resoruces.py

_pysidedeploy.spec
_generated_icon.png

_version.py
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[build-system]
requires = ["hatchling"]
requires = [
"hatchling",
"hatch-vcs",
]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -37,7 +40,10 @@ dynamic = ["version"]
"Releases" = "https://github.com/leocov-dev/pyside-app-core/releases"

[tool.hatch.version]
path = "src/pyside_app_core/__about__.py"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/pyside_app_core/_version.py"

[tool.hatch.build.targets.wheel]
packages = [
Expand All @@ -48,6 +54,13 @@ packages = [
[project.entry-points.hatch]
pyside-app = "pyside_app_build.hooks"

# release ---
[tool.semantic_release]
tag_format = "{version}"

[tool.semantic_release.remote.token]
env = "GITHUB_TOKEN"

# default ---------------------------------------------------------------
[tool.hatch.envs.default]
type = "virtual"
Expand Down

0 comments on commit 50561f7

Please sign in to comment.