diff --git a/.github/workflows/python_release.yml b/.github/workflows/python_release.yml index 6fece41..79c1e08 100644 --- a/.github/workflows/python_release.yml +++ b/.github/workflows/python_release.yml @@ -5,17 +5,18 @@ # name: python-release -# section adapted from https://github.com/astral-sh/ruff/blob/main/.github/workflows/release.yaml +# adapted from https://github.com/astral-sh/ruff/blob/main/.github/workflows/release.yaml on: workflow_dispatch: inputs: - tag: - description: "The version to tag, without the leading 'v'. If omitted, will initiate a dry run (no uploads)." - type: string sha: description: "The full sha of the commit to be released. If omitted, the latest commit on the default branch will be used." default: "" type: string + release: + description: 'Set to true to run the release on pypi, dry run otherwise' + required: true + default: 'false' pull_request: paths: # When we change pyproject.toml, we want to ensure that the maturin builds still work @@ -36,6 +37,8 @@ jobs: target: [x86_64] steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -61,6 +64,8 @@ jobs: target: [x64] steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -86,6 +91,8 @@ jobs: target: [x86_64, aarch64] steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -106,6 +113,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - name: Build sdist uses: PyO3/maturin-action@v1 with: @@ -120,8 +129,12 @@ jobs: release: name: Release runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" - needs: [linux, windows, macos, sdist] + if: "github.event.inputs.release == 'true'" + needs: + - linux + - windows + - macos + - sdist environment: name: pypi url: https://pypi.org/p/cryo-python