Skip to content

Commit f3a49ee

Browse files
committed
Rename
1 parent e387660 commit f3a49ee

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

.github/workflows/rust.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,46 @@ jobs:
1515
os:
1616
- windows-latest
1717
- ubuntu-latest
18+
- macos-latest
1819
file:
1920
# - ${{ github.event.repository.name }}
2021
- bin1
2122
- bin2
2223
runs-on: ${{ matrix.os }}
2324
# outputs:
2425
# 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 }}
2531
steps:
2632
- uses: actions/checkout@master
2733
- name: Build
2834
env:
2935
CARGO_TERM_COLOR: always
3036
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 }}
3151
- name: Upload
3252
uses: actions/upload-artifact@master
3353
id: artifact-upload-step
3454
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 }}
3758
# - name: Output artifact URL
3859
# run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}'
3960

@@ -45,18 +66,22 @@ jobs:
4566
os:
4667
- windows-latest
4768
- ubuntu-latest
69+
- macos-latest
4870
file:
4971
# - ${{ github.event.repository.name }}
5072
- bin1
5173
- bin2
5274
runs-on: ubuntu-latest
5375
needs: build
76+
if: '!cancelled()' # always(), Same as success() || failure()
5477
permissions:
5578
contents: write
79+
env:
80+
ARTIFACT_NAME: Binary-${{ matrix.file }}-${{ matrix.os }}
5681
steps:
5782
- uses: actions/download-artifact@master
5883
with:
59-
name: Binary-${{ matrix.file }}-${{ matrix.os }}
84+
name: ${{ env.ARTIFACT_NAME }}
6085
- name: List files
6186
run: |
6287
ls -lih
@@ -68,4 +93,5 @@ jobs:
6893
files: '*'
6994
- name: Done
7095
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

Comments
 (0)