5
5
branches : [ master ]
6
6
pull_request :
7
7
branches : [ master ]
8
- workflow_dispatch :
9
- inputs :
10
- branch :
11
- description : ' Branch to run the workflow on'
12
- required : false
13
- default : ' master'
14
8
15
9
jobs :
16
10
build :
@@ -21,34 +15,36 @@ jobs:
21
15
python-version : ["3.8", "3.9", "3.10", "3.11"]
22
16
23
17
steps :
24
- - uses : actions/checkout@v3
25
- with :
26
- ref : ${{ github.event.inputs.branch || github.ref }}
27
-
18
+ - uses : actions/checkout@v4
19
+
28
20
- name : Set up Python ${{ matrix.python-version }}
29
- uses : actions/setup-python@v4
21
+ uses : actions/setup-python@v5
30
22
with :
31
23
python-version : ${{ matrix.python-version }}
32
24
33
- - name : Set Branch Name
25
+ - name : Determine Branch Name
34
26
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 }}"
37
29
else
38
- echo " branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
30
+ branch_name=" ${{ github.ref_name }}"
39
31
fi
32
+ echo "branch_name=$branch_name" >> $GITHUB_ENV
40
33
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')
37
+ sanitized_git_hash=$(git rev-parse --short "$GITHUB_SHA" | sed 's/[^a-zA-Z0-9_]/_/g')
38
+ echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV
39
+ echo "sanitized_git_hash=$sanitized_git_hash" >> $GITHUB_ENV
46
40
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"
49
45
50
46
- name : Setup Node.js
51
- uses : actions/setup-node@v4
47
+ uses : actions/setup-node@v3
52
48
with :
53
49
node-version : 18
54
50
@@ -60,21 +56,14 @@ jobs:
60
56
61
57
- name : Build Extension in Dev Mode
62
58
run : pip install -e .
63
-
59
+
64
60
- name : Build Wheel
65
61
run : |
66
62
python -m pip install --upgrade build
67
63
python -m build
68
64
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
77
67
with :
78
68
name : xircuits-wheel-${{ env.sanitized_branch_name }}-${{ env.sanitized_git_hash }}
79
69
path : dist
80
- if-no-files-found : warn
0 commit comments