From fead8de1338b8ce9dba1e36ea15aa06f0f044a37 Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Thu, 13 Aug 2026 17:06:29 +0200 Subject: [PATCH] Migrate automation to compas-actions v1 --- .github/workflows/build.yml | 23 +++++-- .github/workflows/docs.yml | 14 ++-- .github/workflows/pr-checks.yml | 20 ++++-- .github/workflows/prepare-release.yml | 26 ++++++++ .github/workflows/release.yml | 92 ++++++++++++++++++--------- CHANGELOG.md | 1 + 6 files changed, 123 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/prepare-release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe75e95..58bacc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,13 +8,26 @@ on: branches: - main +permissions: + contents: read + jobs: + release-change: + name: Detect release merge + runs-on: ubuntu-latest + outputs: + is-release: ${{ steps.release.outputs.is-release }} + steps: + - uses: compas-dev/compas-actions/release-check@v1 + id: release + build: - if: "!contains(github.event.pull_request.labels.*.name, 'docs-only')" + needs: release-change + if: github.event_name == 'pull_request' || needs.release-change.outputs.is-release != 'true' runs-on: ubuntu-latest steps: - - uses: compas-dev/compas-actions.build@v5 + - uses: compas-dev/compas-actions/ci@v1 with: - python: "3.11" - invoke_lint: true - invoke_test: true + python-version: "3.11" + management-tool: uv + invoke-tasks: lint test diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 56c77c4..8ad5013 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,25 +1,19 @@ name: docs on: - push: - branches: - - main - tags: - - "v*" pull_request: branches: - main permissions: - contents: write + contents: read jobs: docs: runs-on: ubuntu-latest steps: - - uses: compas-dev/compas-actions.docs@v5 + - uses: compas-dev/compas-actions/docs@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - python: "3.11" - generator: mkdocs + python-version: "3.11" extras: dev + strict: false diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 885de3e..e0518e9 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -6,15 +6,21 @@ on: branches: - main +permissions: + contents: read + jobs: + release: + name: Validate release metadata + runs-on: ubuntu-latest + steps: + - uses: compas-dev/compas-actions/release-check@v1 + changelog: - name: Changelog check + name: Check changelog runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: Zomzog/changelog-checker@v1.2.0 + - uses: compas-dev/compas-actions/pr-checks@v1 with: - fileName: CHANGELOG.md - checkNotification: Simple - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + changelog-path: CHANGELOG.md + skip-label: no changelog diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..634adab --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,26 @@ +name: prepare release + +on: + workflow_dispatch: + inputs: + release-type: + description: Semantic version component to bump + required: true + type: choice + options: + - patch + - minor + - major + +permissions: + contents: write + pull-requests: write + +jobs: + release-pr: + runs-on: ubuntu-latest + steps: + - uses: compas-dev/compas-actions/release-pr@v1 + with: + release-type: ${{ inputs.release-type }} + github-token: ${{ github.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a16541..96928b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,59 +2,89 @@ name: release on: push: - tags: - - "v*" + branches: + - main + +permissions: + contents: read jobs: + release: + name: Detect release merge + runs-on: ubuntu-latest + outputs: + is-release: ${{ steps.release.outputs.is-release }} + version: ${{ steps.release.outputs.version }} + tag: ${{ steps.release.outputs.tag }} + steps: + - uses: compas-dev/compas-actions/release-check@v1 + id: release + build: - name: build distributions + needs: release + if: needs.release.outputs.is-release == 'true' runs-on: ubuntu-latest - permissions: - contents: read steps: - - uses: compas-dev/compas-actions.build@v5 + - uses: compas-dev/compas-actions/ci@v1 with: - invoke_lint: true - invoke_test: true - python: "3.11" - - - name: Build distributions - run: python -m build + python-version: "3.11" + management-tool: uv + invoke-tasks: lint test - - name: Upload distributions - uses: actions/upload-artifact@v4 + prepare: + needs: [release, build] + if: needs.release.outputs.is-release == 'true' + runs-on: ubuntu-latest + steps: + - uses: compas-dev/compas-actions/prepare-release@v1 with: - name: python-package-distributions - path: dist/ - if-no-files-found: error + python-version: "3.11" + management-tool: uv publish: - name: publish to PyPI - needs: build + needs: [release, prepare] + if: needs.release.outputs.is-release == 'true' runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/compas-threejs permissions: + contents: read id-token: write steps: - - name: Download distributions - uses: actions/download-artifact@v4 + - name: Download package distributions + uses: actions/download-artifact@v8.0.1 with: name: python-package-distributions - path: dist/ + path: dist - - name: Publish distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@v1.14.2 - github-release: - name: create GitHub release - needs: publish + create-release: + needs: [release, publish] + if: needs.release.outputs.is-release == 'true' runs-on: ubuntu-latest permissions: contents: write steps: - - name: Create GitHub release - env: - GH_TOKEN: ${{ github.token }} - run: gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --generate-notes --title "$GITHUB_REF_NAME" + - uses: compas-dev/compas-actions/github-release@v1 + with: + github-token: ${{ github.token }} + tag-name: ${{ needs.release.outputs.tag }} + target: ${{ github.sha }} + + docs: + needs: [release, create-release] + if: needs.release.outputs.is-release == 'true' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: compas-dev/compas-actions/docs@v1 + with: + deploy: true + version: ${{ needs.release.outputs.version }} + python-version: "3.11" + extras: dev + strict: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c28eb..236504c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Migrated CI, documentation, and trusted publishing to `compas-actions@v1` and repository-owned release pull requests - Transferred project ownership and copyright to the COMPAS Association - Updated the bundled TypeScript viewer to the current public-release build - Made the default physical-material attenuation distance JSON-safe