Merge pull request #849 from gramaziokohler/newgen_ci #62
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: release | |
| on: | |
| push: | |
| 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: | |
| needs: release | |
| if: needs.release.outputs.is-release == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python: ['3.9', '3.12', '3.14'] | |
| exclude: | |
| # Rhino 8 ships Python 3.9, so it stays in the matrix. The ci action | |
| # installs interpreters with actions/setup-python, which has no | |
| # darwin-arm64 build for 3.9, so that one cell cannot run. macOS is | |
| # covered on 3.12/3.14 and 3.9 is covered on the other runners. | |
| - os: macos-latest | |
| python: '3.9' | |
| steps: | |
| - uses: compas-dev/compas-actions/ci@v1 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| management-tool: uv | |
| extras: dev | |
| run-prebuild: true | |
| invoke-tasks: lint test | |
| 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: | |
| python-version: '3.12' | |
| management-tool: uv | |
| extras: dev | |
| run-prebuild: true | |
| assets: | |
| needs: [release, build] | |
| if: needs.release.outputs.is-release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| # compas_timber owns these .proto files, so each release publishes the | |
| # schema bundle and the per-language bindings next to the wheel. This is a | |
| # job of its own rather than prepare-release's `release-assets` input, | |
| # because that input ties asset generation to `invoke pre-build` -- which | |
| # every lint/test/wheel job runs, and which has no business pulling in | |
| # protoc plugins and node for languages those jobs never build. | |
| - uses: compas-dev/compas-actions/release-assets@v1 | |
| with: | |
| python-version: '3.12' | |
| management-tool: uv | |
| extras: dev | |
| invoke-tasks: create-class-assets | |
| paths: dist/proto/*.zip | |
| publish: | |
| # `assets` gates the upload on purpose: PyPI publishing cannot be undone, so | |
| # a failure to build the release assets should stop the release before it, | |
| # not leave a published wheel with no GitHub release to accompany it. | |
| needs: [release, prepare, assets] | |
| if: needs.release.outputs.is-release == 'true' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/compas-timber | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download package distributions | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: python-package-distributions | |
| path: dist | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@v1.14.2 | |
| create-release: | |
| needs: [release, publish, assets] | |
| if: needs.release.outputs.is-release == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: compas-dev/compas-actions/github-release@v1 | |
| with: | |
| github-token: ${{ github.token }} | |
| tag-name: ${{ needs.release.outputs.tag }} | |
| target: ${{ github.sha }} | |
| # without this the action defaults to "" and skips the download, so the | |
| # proto bundle and bindings would never reach the release | |
| release-assets-artifact-name: github-release-assets | |
| 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.12' | |
| extras: dev | |
| config-file: mkdocs.yml | |
| strict: false |