Release all changed packages #4
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 all changed packages | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| default: 'dev' | |
| type: choice | |
| options: | |
| - dev | |
| - stable | |
| publish_to: | |
| description: 'Publish to' | |
| required: true | |
| default: 'testpypi' | |
| type: choice | |
| options: | |
| - testpypi | |
| - pypi | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Run tests | |
| run: | | |
| uv sync | |
| uv run pytest -x -q | |
| - name: Run lint | |
| run: uv run ruff check hexdag/ hexdag_plugins/ | |
| detect: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| outputs: | |
| hexdag: ${{ steps.check.outputs.hexdag }} | |
| plugins: ${{ steps.check.outputs.plugins }} | |
| studio: ${{ steps.check.outputs.studio }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Detect changed packages | |
| id: check | |
| run: | | |
| CHANGED=$(python scripts/detect_changes.py) | |
| echo "Changed packages: $CHANGED" | |
| echo "hexdag=$(echo $CHANGED | python -c 'import sys,json; print(str("hexdag" in json.load(sys.stdin)).lower())')" >> $GITHUB_OUTPUT | |
| echo "plugins=$(echo $CHANGED | python -c 'import sys,json; print(str("hexdag-plugins" in json.load(sys.stdin)).lower())')" >> $GITHUB_OUTPUT | |
| echo "studio=$(echo $CHANGED | python -c 'import sys,json; print(str("hexdag-studio" in json.load(sys.stdin)).lower())')" >> $GITHUB_OUTPUT | |
| release-hexdag: | |
| needs: detect | |
| if: needs.detect.outputs.hexdag == 'true' | |
| uses: ./.github/workflows/release.yml | |
| with: | |
| release_type: ${{ inputs.release_type }} | |
| publish_to: ${{ inputs.publish_to }} | |
| skip_tests: true | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| id-token: write | |
| release-plugins: | |
| needs: [detect, release-hexdag] | |
| if: always() && needs.detect.outputs.plugins == 'true' && (needs.release-hexdag.result == 'success' || needs.release-hexdag.result == 'skipped') | |
| uses: ./.github/workflows/release-plugins.yml | |
| with: | |
| release_type: ${{ inputs.release_type }} | |
| publish_to: ${{ inputs.publish_to }} | |
| skip_tests: true | |
| pull_latest: true | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| id-token: write | |
| release-studio: | |
| needs: [detect, release-plugins] | |
| if: always() && needs.detect.outputs.studio == 'true' && (needs.release-plugins.result == 'success' || needs.release-plugins.result == 'skipped') | |
| uses: ./.github/workflows/release-studio.yml | |
| with: | |
| release_type: ${{ inputs.release_type }} | |
| publish_to: ${{ inputs.publish_to }} | |
| skip_tests: true | |
| pull_latest: true | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| id-token: write |