diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index a6026a199a..9bbcc75a78 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -2,6 +2,7 @@ name: Release (nightly) on: schedule: - cron: '23 23 * * *' + workflow_dispatch: permissions: {} @@ -19,6 +20,22 @@ jobs: with: fetch-depth: 0 persist-credentials: false + + - name: Retrieve HEAD commit hash + id: head + shell: bash + run: echo "head=$(git rev-parse HEAD)" | tee -a "${GITHUB_OUTPUT}" + + - name: Cache nightly commit hash + uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 + with: + path: .nightly_commit_hash + key: release-nightly-${{ steps.head.outputs.head }} + restore-keys: | + release-nightly- + - name: Check for new commits id: check_for_new_commits shell: bash @@ -35,7 +52,22 @@ jobs: ".github/workflows/release.yml" ".github/workflows/release-nightly.yml" ) - echo "commit=$(git log --format=%H -1 --since="24 hours ago" -- "${relevant_files[@]}")" | tee "$GITHUB_OUTPUT" + if [[ -f .nightly_commit_hash ]]; then + limit_args=( + "$(cat .nightly_commit_hash)..HEAD" + ) + else + limit_args=( + --since="24 hours ago" + ) + fi + echo "commit=$(git log --format=%H -1 "${limit_args[@]}" -- "${relevant_files[@]}")" | tee -a "${GITHUB_OUTPUT}" + + - name: Record new nightly commit hash + env: + HEAD: ${{ steps.head.outputs.head }} + shell: bash + run: echo "${HEAD}" | tee .nightly_commit_hash release: name: Publish Github release @@ -66,6 +98,7 @@ jobs: with: path: dist name: build-pypi + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 584ac13be9..1ef565723d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -215,7 +215,7 @@ jobs: python -m build --no-isolation . - name: Upload artifacts - if: github.event_name != 'workflow_dispatch' + if: github.event.workflow != '.github/workflows/release.yml' # Reusable workflow_call uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: build-pypi @@ -224,7 +224,7 @@ jobs: compression-level: 0 - name: Publish to PyPI - if: github.event_name == 'workflow_dispatch' + if: github.event.workflow == '.github/workflows/release.yml' # Direct workflow_dispatch uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 with: verbose: true