build(deps): bump python-semantic-release/publish-action from 9.21.1 to 10.0.2 #509
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Test | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: test with ${{ matrix.env }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- "3.13" | |
- "3.12" | |
- "3.11" | |
os: | |
- ubuntu-latest | |
- macos-latest | |
# - windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup UV | |
uses: astral-sh/setup-uv@v6 | |
with: | |
activate-environment: true | |
- name: Add .local/bin to Windows PATH | |
if: runner.os == 'Windows' | |
shell: bash | |
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH | |
- name: Install tox | |
run: uv tool install --python-preference only-managed --python | |
3.13 tox --with tox-uv # --with tox-gh | |
- name: Setup Python | |
if: matrix.env != '3.13' | |
run: | |
uv python install --python-preference only-managed ${{ | |
matrix.env }} | |
- name: Setup Tests | |
run: tox run -vv --notest --skip-missing-interpreters false | |
env: | |
TOX_GH_MAJOR_MINOR: ${{ matrix.env }} | |
- name: Run test suite | |
run: tox run --skip-pkg-install | |
env: | |
AOC_SESSION: ${{ secrets.AOC_SESSION }} | |
TOX_GH_MAJOR_MINOR: ${{ matrix.env }} | |
- name: Rename reports | |
if: success() || failure() | |
run: >- | |
mv junit.xml "junit-${{ matrix.os }}-${{ matrix.env }}.xml" ; | |
mv ruff.json "ruff-${{ matrix.os }}-${{ matrix.env }}.json" ; | |
mv coverage.xml "coverage-${{ matrix.os }}-${{ matrix.env | |
}}.xml" | |
- name: Upload JUnit results | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-${{ matrix.os }}-${{ matrix.env }} | |
path: | | |
coverage*.xml | |
junit-*.xml | |
ruff-*.json | |
retention-days: 1 | |
- name: Publish Test Report | |
uses: dorny/test-reporter@v2 | |
if: success() || failure() | |
with: | |
name: Tox Tests (${{ matrix.env }}) | |
path: "junit-*.xml" | |
reporter: java-junit | |
check_sonar_secret: | |
name: check if SONAR_TOKEN is set in github secrets | |
runs-on: ubuntu-latest | |
outputs: | |
is_SONAR_TOKEN_set: | |
${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }} | |
steps: | |
- name: Check whether Sonar Scan should be done | |
id: checksecret_job | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
echo "is_SONAR_TOKEN_set: ${{ env.SONAR_TOKEN != '' }}" | |
echo "::set-output name=is_SONAR_TOKEN_set::${{ env.SONAR_TOKEN != '' }}" | |
sonar: | |
needs: | |
- test | |
- check_sonar_secret | |
concurrency: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Obtain Project Version | |
uses: SebRollen/toml-action@v1.2.0 | |
id: proj-version | |
with: | |
file: pyproject.toml | |
field: project.version | |
- name: Cache SonarQube packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Download JUnit reports | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
merge-multiple: true | |
env: | |
PARALLEL_DOWNLOADS: 1 | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarqube-scan-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.projectVersion=${{ | |
steps.proj-version.outputs.value }} | |
release: | |
needs: test | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
if: | |
github.event_name == 'push' && github.ref == 'refs/heads/main' && | |
!contains(github.event.head_commit.message, 'chore(release):') | |
runs-on: ubuntu-latest | |
outputs: | |
released: ${{ steps.release.outputs.released }} | |
steps: | |
# Note: we need to checkout the repository at the workflow sha in case during the workflow | |
# the branch was updated. To keep PSR working with the configured release branches, | |
# we force a checkout of the desired release branch but at the workflow sha HEAD. | |
- name: Setup | Checkout Repository at workflow sha | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.sha }} | |
- name: Setup | Force correct release branch on workflow sha | |
run: | | |
git checkout -B ${{ github.ref_name }} ${{ github.sha }} | |
- name: Setup | Install UV | |
uses: astral-sh/setup-uv@v6 | |
with: | |
version: latest | |
enable-cache: true | |
- name: Setup | Install Python | |
run: uv python install | |
- name: Action | Semantic Version Release | |
id: release | |
# Adjust tag with desired version if applicable. | |
uses: python-semantic-release/python-semantic-release@v9.21.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
git_committer_name: "github-actions" | |
git_committer_email: "actions@users.noreply.github.com" | |
- name: Publish | Upload to GitHub Release Assets | |
uses: python-semantic-release/publish-action@v10.0.2 | |
if: steps.release.outputs.released == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.release.outputs.tag }} | |
docker-image: | |
needs: release | |
concurrency: release | |
runs-on: ubuntu-latest | |
if: ${{ needs.release.outputs.released }} == "true" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the container registry | |
uses: docker/login-action@6d4b68b490aef8836e8fb5e50ee7b3bdfa5894f0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@418e4b98bf2841bd337d0b24fe63cb36dc8afa55 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@0788c444d8b4d67580213712e34a148cae3a6c4e | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |