55 branches : [ master ]
66 pull_request :
77 branches : [ master ]
8- workflow_dispatch :
9- inputs :
10- branch :
11- description : ' Branch to run the workflow on'
12- required : false
13- default : ' master'
148
159jobs :
1610 build :
@@ -21,31 +15,33 @@ jobs:
2115 python-version : ["3.8", "3.9", "3.10", "3.11"]
2216
2317 steps :
24- - uses : actions/checkout@v3
25- with :
26- ref : ${{ github.event.inputs.branch || github.ref }}
27-
18+ - uses : actions/checkout@v4
19+
2820 - name : Set up Python ${{ matrix.python-version }}
29- uses : actions/setup-python@v4
21+ uses : actions/setup-python@v5
3022 with :
3123 python-version : ${{ matrix.python-version }}
3224
33- - name : Set Branch Name
25+ - name : Determine Branch Name
3426 run : |
35- if [ "${{ github.event_name }}" == "workflow_dispatch " ]; then
36- echo " branch_name=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
27+ if [ "${{ github.event_name }}" == "pull_request " ]; then
28+ branch_name=" ${{ github.head_ref }}"
3729 else
38- echo " branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
30+ branch_name=" ${{ github.ref_name }}"
3931 fi
32+ echo "branch_name=$branch_name" >> $GITHUB_ENV
4033
41- - name : Check Branch
42- run : echo "Branch name is ${{ env.branch_name }}"
43-
44- - name : Get Hash
45- run : echo "git_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
34+ - name : Sanitize Branch Name and Git Hash
35+ run : |
36+ sanitized_branch_name=$(echo "$branch_name" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens
37+ sanitized_git_hash=$(git rev-parse --short "$GITHUB_SHA" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens
38+ echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV
39+ echo "sanitized_git_hash=$sanitized_git_hash" >> $GITHUB_ENV
4640
47- - name : Check Hash
48- run : echo "Git hash is ${{ env.git_hash }}"
41+ - name : Check Branch and Hash
42+ run : |
43+ echo "Branch: $sanitized_branch_name"
44+ echo "Hash: $sanitized_git_hash"
4945
5046 - name : Setup Node.js
5147 uses : actions/setup-node@v4
@@ -60,21 +56,14 @@ jobs:
6056
6157 - name : Build Extension in Dev Mode
6258 run : pip install -e .
63-
59+
6460 - name : Build Wheel
6561 run : |
6662 python -m pip install --upgrade build
6763 python -m build
6864
69- - name : Sanitize Branch Name and Git Hash
70- run : |
71- sanitized_branch_name=$(echo "${{ env.branch_name }}" | sed 's/[^a-zA-Z0-9_]/_/g')
72- sanitized_git_hash=$(echo "${{ env.git_hash }}" | sed 's/[^a-zA-Z0-9_]/_/g')
73- echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV
74- echo "sanitized_git_hash=$sanitized_git_hash" >> $GITHUB_ENV
75-
76- - uses : actions/upload-artifact@v3
65+ - name : Upload Dist Directory Artifact
66+ uses : actions/upload-artifact@v4
7767 with :
78- name : xircuits-wheel-${{ env.sanitized_branch_name }}-${{ env.sanitized_git_hash }}
68+ name : xircuits-wheel-${{ env.sanitized_branch_name }}-${{ matrix.python-version }}-${{ env.sanitized_git_hash }}
7969 path : dist
80- if-no-files-found : warn
0 commit comments