-
Notifications
You must be signed in to change notification settings - Fork 731
50 lines (48 loc) · 1.72 KB
/
release_powerlift.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: release_powerlift
on:
workflow_dispatch:
inputs:
commit_id:
description: 'Commit ID (required for manual trigger)'
required: true
jobs:
publish_powerlift:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Find CI workflow run by commit ID
id: find_workflow
run: |
commit_id="${{ github.event.inputs.commit_id }}"
if [ -z "$commit_id" ]; then
echo "Error: commit_id is empty."
exit 1
fi
if git show-ref --verify --quiet refs/heads/${commit_id}; then
# If it's a valid branch, resolve it to a commit ID
commit_id=$(git rev-parse ${commit_id})
fi
echo "Commit ID: ${commit_id}"
workflow_runs=$(gh api -X GET "/repos/${{ github.repository }}/actions/runs?status=success" -q '.workflow_runs | map(select(.head_commit.id == "'"${commit_id}"'" and .name == "interpret-CI")) | sort_by(.created_at) | reverse | .[0]')
run_id=$(echo "$workflow_runs" | jq -r '.id')
echo "Run ID: ${run_id}"
echo "run_id=${run_id}" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download powerlift artifact
uses: actions/download-artifact@v4
with:
run-id: ${{ env.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
name: powerlift
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1