fix: semantic release config
Build and Publish / release (push) Successful in 1s
CI / lint (push) Successful in 16s
CI / test (3.12) (push) Successful in 24s
CI / test (3.11) (push) Successful in 26s
CI / test (3.13) (push) Successful in 24s

This commit is contained in:
2026-07-02 21:57:11 +02:00
committed by perl_d
parent 91166de646
commit 099b09dd98
3 changed files with 85 additions and 85 deletions
+80 -79
View File
@@ -1,3 +1,79 @@
# name: Build and Publish
# on:
# push:
# branches:
# - main
# jobs:
# release:
# runs-on: ubuntu-latest
# concurrency:
# group: ${{ github.workflow }}-release-${{ github.ref_name }}
# cancel-in-progress: false
# outputs:
# release_made: ${{ steps.release_step.outputs.release_made }}
# permissions:
# contents: write
# steps:
# - name: Setup | Checkout Repository on Release Branch
# uses: actions/checkout@v6
# with:
# ref: ${{ github.ref_name }}
# fetch-depth: 0
# - name: Set up Python
# uses: actions/setup-python@v6
# with:
# python-version: "3.11"
# - name: Setup | Force release branch to be at workflow sha
# run: |
# git reset --hard ${{ github.sha }}
# - name: Evaluate | Verify upstream has NOT changed
# shell: bash
# run: |
# set +o pipefail
# UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)"
# printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME"
# set -o pipefail
# if [ -z "$UPSTREAM_BRANCH_NAME" ]; then
# printf >&2 '%s\n' "::error::Unable to determine upstream branch name!"
# exit 1
# fi
# git fetch "${UPSTREAM_BRANCH_NAME%%/*}"
# if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then
# printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!"
# exit 1
# fi
# HEAD_SHA="$(git rev-parse HEAD)"
# if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then
# printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]"
# printf >&2 '%s\n' "::error::Upstream has changed, aborting release..."
# exit 1
# fi
# printf '%s\n' "Verified upstream branch has not changed, continuing with release..."
# - name: Semantic Version Release
# id: release_step
# env:
# TWINE_USERNAME: "__token__"
# TWINE_PASSWORD: ${{ secrets.PIP_REPOSITORY_API_TOKEN }}
# GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
# run: |
# pip install python-semantic-release==9.* wheel build twine
# semantic-release --config ./ci/semantic_release.toml version
# if [ ! -d dist ]; then echo No release will be made; echo "release_made=false" >> "$GITHUB_OUTPUT"; exit 0; fi
# echo "release_made=true" >> "$GITHUB_OUTPUT"
# twine upload dist/* --repository-url https://gitea.psi.ch/api/packages/mx/pypi -u __token__ -p ${{ secrets.CI_PYPI_TOKEN }} --skip-existing
# semantic-release publish
name: Build and Publish
on:
push:
@@ -7,84 +83,9 @@ on:
jobs:
release:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
release_made: ${{ steps.release_step.outputs.release_made }}
permissions:
contents: write
steps:
# Note: We checkout the repository at the branch that triggered the workflow
# with the entire history to ensure to match PSR's release branch detection
# and history evaluation.
# However, we forcefully reset the branch to the workflow sha because it is
# possible that the branch was updated while the workflow was running. This
# prevents accidentally releasing un-evaluated changes.
- name: Setup | Checkout Repository on Release Branch
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Setup | Force release branch to be at workflow sha
- name: debug
run: |
git reset --hard ${{ github.sha }}
- name: Evaluate | Verify upstream has NOT changed
# Last chance to abort before causing an error as another PR/push was applied to
# the upstream branch while this workflow was running. This is important
# because we are committing a version change (--commit). You may omit this step
# if you have 'commit: false' in your configuration.
#
# You may consider moving this to a repo script and call it from this step instead
# of writing it in-line.
shell: bash
run: |
set +o pipefail
UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)"
printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME"
set -o pipefail
if [ -z "$UPSTREAM_BRANCH_NAME" ]; then
printf >&2 '%s\n' "::error::Unable to determine upstream branch name!"
exit 1
fi
git fetch "${UPSTREAM_BRANCH_NAME%%/*}"
if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then
printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!"
exit 1
fi
HEAD_SHA="$(git rev-parse HEAD)"
if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then
printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]"
printf >&2 '%s\n' "::error::Upstream has changed, aborting release..."
exit 1
fi
printf '%s\n' "Verified upstream branch has not changed, continuing with release..."
- name: Semantic Version Release
id: release_step
env:
TWINE_USERNAME: "__token__" # Username for Twine when using token-based auth
TWINE_PASSWORD: ${{ secrets.PIP_REPOSITORY_API_TOKEN }} # Use the secret for authentication
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install python-semantic-release==9.* wheel build twine
semantic-release --config ./ci/semantic_release.toml version
if [ ! -d dist ]; then echo No release will be made; echo "release_made=false" >> "$GITHUB_OUTPUT"; exit 0; fi
echo "release_made=true" >> "$GITHUB_OUTPUT"
twine upload dist/* --repository-url https://gitea.psi.ch/api/packages/mx/pypi -u __token__ -p ${{ secrets.CI_PYPI_TOKEN }} --skip-existing
semantic-release publish
echo $GITHUB_API_URL
echo $GITEA_SERVER_URL
echo $env
+4 -5
View File
@@ -25,13 +25,12 @@ minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0
[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = true
[semantic_release.remote]
type = "gitea"
domain = "gitea.psi.ch"
[tool.semantic_release.remote.token]
env = "GH_TOKEN"
env = "GITEA_TOKEN"
[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "aarecommon"
version = "0.1"
version = "0.1.0"
description = "Common components (models, calculations) for Aare packages"
readme = "README.md"
requires-python = ">=3.11"