diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4266ebff..d026f2420 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,13 +6,6 @@ on: - published workflow_dispatch: inputs: - version: - description: 'Release version' - required: true - environment: - description: 'Deployment environment' - required: true - default: 'production' commit_id: description: 'Commit ID (required for manual trigger)' required: true @@ -21,26 +14,20 @@ jobs: publish_packages: runs-on: ubuntu-latest steps: - - name: Set commit ID - id: set_commit_id + - name: Find CI workflow run by commit ID + id: find_workflow run: | if [ "${{ github.event_name }}" == "release" ]; then commit_id="${{ github.event.release.target_commitish }}" else commit_id="${{ github.event.inputs.commit_id }}" fi - echo "Commit ID: ${commit_id}" - echo "::set-output name=commit_id::${commit_id}" - - name: Find workflow run by commit ID - id: find_workflow - run: | - commit_id="${{ steps.set_commit_id.outputs.commit_id }}" if [ -z "$commit_id" ]; then echo "Error: commit_id is empty." exit 1 fi echo "Commit ID: ${commit_id}" - workflow_runs=$(gh api -X GET "/repos/${{ github.repository }}/actions/runs?event=push&status=success" -q '.workflow_runs[] | select(.head_commit.id=="'${commit_id}'")') + workflow_runs=$(gh api -X GET "/repos/${{ github.repository }}/actions/runs?event=push&status=success" -q '.workflow_runs[] | select(.head_commit.id=="'${commit_id}'") | sort_by(.created_at) | reverse | .[0]') run_id=$(echo "$workflow_runs" | jq -r '.id') echo "Run ID: ${run_id}" echo "::set-output name=run_id::${run_id}" @@ -50,6 +37,6 @@ jobs: uses: actions/download-artifact@v4 with: run-id: ${{ steps.find_workflow.outputs.run_id }} - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{ secrets.GITHUB_TOKEN }} name: npm path: bld/npm