@@ -15,25 +15,46 @@ jobs:
15
15
os :
16
16
- windows-latest
17
17
- ubuntu-latest
18
+ - macos-latest
18
19
file :
19
20
# - ${{ github.event.repository.name }}
20
21
- bin1
21
22
- bin2
22
23
runs-on : ${{ matrix.os }}
23
24
# outputs:
24
25
# artifact-url: ${{ steps.artifact-upload-step.outputs.artifact-url }}
26
+ env :
27
+ NAME : ${{ format('target/release/{0}{1}', matrix.file, startsWith(matrix.os, 'windows') && '.exe' || '') }}
28
+ # Can't access runner context
29
+ # NEW_NAME: ${{ format('target/release/{0}-{1}-{2}{3}', matrix.file, github.ref_name, matrix.os, startsWith(matrix.os, 'windows') && '.exe' || '') }}
30
+ ARTIFACT_NAME : Binary-${{ matrix.file }}-${{ matrix.os }}
25
31
steps :
26
32
- uses : actions/checkout@master
27
33
- name : Build
28
34
env :
29
35
CARGO_TERM_COLOR : always
30
36
run : cargo build --release --verbose
37
+ - name : Naming ${{ env.NEW_NAME }}
38
+ id : naming
39
+ shell : bash
40
+ env :
41
+ NEW_NAME : >-
42
+ ${{ format('target/release/{0}-{1}-{2}-{3}{4}',
43
+ matrix.file, github.ref_name, runner.os, runner.arch, startsWith(matrix.os, 'windows') && '.exe' || '') }}
44
+ run : |
45
+ export NAME="$( echo ${{ env.NEW_NAME }} | tr [:upper:] [:lower:] )"
46
+ echo "FILENAME=$NAME" >> $GITHUB_OUTPUT
47
+ - name : Rename files
48
+ shell : bash
49
+ run : |
50
+ mv $NAME ${{ steps.naming.outputs.FILENAME }}
31
51
- name : Upload
32
52
uses : actions/upload-artifact@master
33
53
id : artifact-upload-step
34
54
with :
35
- name : Binary-${{ matrix.file }}-${{ matrix.os }}
36
- path : target/release/${{ matrix.file }}${{ runner.os == 'Windows' && '.exe' || '' }}
55
+ name : ${{ env.ARTIFACT_NAME }}
56
+ # path: ${{ env.NEW_NAME }}
57
+ path : ${{ steps.naming.outputs.FILENAME }}
37
58
# - name: Output artifact URL
38
59
# run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}'
39
60
@@ -45,18 +66,22 @@ jobs:
45
66
os :
46
67
- windows-latest
47
68
- ubuntu-latest
69
+ - macos-latest
48
70
file :
49
71
# - ${{ github.event.repository.name }}
50
72
- bin1
51
73
- bin2
52
74
runs-on : ubuntu-latest
53
75
needs : build
76
+ if : ' !cancelled()' # always(), Same as success() || failure()
54
77
permissions :
55
78
contents : write
79
+ env :
80
+ ARTIFACT_NAME : Binary-${{ matrix.file }}-${{ matrix.os }}
56
81
steps :
57
82
- uses : actions/download-artifact@master
58
83
with :
59
- name : Binary- ${{ matrix.file }}-${{ matrix.os }}
84
+ name : ${{ env.ARTIFACT_NAME }}
60
85
- name : List files
61
86
run : |
62
87
ls -lih
68
93
files : ' *'
69
94
- name : Done
70
95
run : |
71
- echo "### [${{ github.ref_name }}](https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ github.ref_name }}) Released! :rocket:" >> $GITHUB_STEP_SUMMARY
96
+ echo "### [${{ github.ref_name }}](https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ github.ref_name }}) Released! :rocket:" \
97
+ >> $GITHUB_STEP_SUMMARY
0 commit comments