Release #21
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: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| default: 'dev' | |
| type: choice | |
| options: | |
| - dev # 0.7.0 -> 0.8.0.dev1, or 0.8.0.dev1 -> 0.8.0.dev2 | |
| - stable # 0.8.0.dev2 -> 0.8.0 | |
| publish_to: | |
| description: 'Publish to' | |
| required: true | |
| default: 'testpypi' | |
| type: choice | |
| options: | |
| - testpypi | |
| - pypi | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| # ── Test ──────────────────────────────────────────────────────────── | |
| 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 changed packages ───────────────────────────────────────── | |
| 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 ────────────────────────────────────────────────── | |
| release-hexdag: | |
| needs: detect | |
| if: needs.detect.outputs.hexdag == 'true' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ inputs.publish_to }} | |
| url: ${{ inputs.publish_to == 'pypi' && 'https://pypi.org/project/hexdag/' || 'https://test.pypi.org/project/hexdag/' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Release hexdag | |
| uses: ./.github/actions/release-package | |
| with: | |
| pyproject_path: pyproject.toml | |
| release_type: ${{ inputs.release_type }} | |
| publish_to: ${{ inputs.publish_to }} | |
| tag_prefix: v | |
| working_directory: . | |
| test_name: hexDAGtest | |
| package_name: hexdag | |
| - name: Publish to Test PyPI | |
| if: inputs.publish_to == 'testpypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| - name: Publish to PyPI | |
| if: inputs.publish_to == 'pypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # ── Release hexdag-plugins ────────────────────────────────────────── | |
| release-plugins: | |
| needs: [detect, release-hexdag] | |
| if: always() && needs.detect.outputs.plugins == 'true' && (needs.release-hexdag.result == 'success' || needs.release-hexdag.result == 'skipped') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ inputs.publish_to }} | |
| url: ${{ inputs.publish_to == 'pypi' && 'https://pypi.org/project/hexdag-plugins/' || 'https://test.pypi.org/project/hexdag-plugins/' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref_name }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull latest changes | |
| run: git pull origin ${{ github.ref_name }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Release hexdag-plugins | |
| uses: ./.github/actions/release-package | |
| with: | |
| pyproject_path: hexdag_plugins/pyproject.toml | |
| release_type: ${{ inputs.release_type }} | |
| publish_to: ${{ inputs.publish_to }} | |
| tag_prefix: plugins-v | |
| working_directory: hexdag_plugins | |
| test_name: hexdag-plugins-test | |
| package_name: hexdag-plugins | |
| - name: Publish to Test PyPI | |
| if: inputs.publish_to == 'testpypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| packages-dir: hexdag_plugins/dist/ | |
| - name: Publish to PyPI | |
| if: inputs.publish_to == 'pypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: hexdag_plugins/dist/ | |
| # ── Release hexdag-studio ─────────────────────────────────────────── | |
| release-studio: | |
| needs: [detect, release-plugins] | |
| if: always() && needs.detect.outputs.studio == 'true' && (needs.release-plugins.result == 'success' || needs.release-plugins.result == 'skipped') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ inputs.publish_to }} | |
| url: ${{ inputs.publish_to == 'pypi' && 'https://pypi.org/project/hexdag-studio/' || 'https://test.pypi.org/project/hexdag-studio/' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref_name }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull latest changes | |
| run: git pull origin ${{ github.ref_name }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Release hexdag-studio | |
| uses: ./.github/actions/release-package | |
| with: | |
| pyproject_path: hexdag-studio/pyproject.toml | |
| release_type: ${{ inputs.release_type }} | |
| publish_to: ${{ inputs.publish_to }} | |
| tag_prefix: studio-v | |
| working_directory: hexdag-studio | |
| test_name: hexdag-studio-test | |
| package_name: hexdag-studio | |
| needs_nodejs: 'true' | |
| nodejs_directory: hexdag-studio/ui | |
| - name: Publish to Test PyPI | |
| if: inputs.publish_to == 'testpypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| packages-dir: hexdag-studio/dist/ | |
| - name: Publish to PyPI | |
| if: inputs.publish_to == 'pypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: hexdag-studio/dist/ |