Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
develon2015 committed Mar 21, 2024
1 parent e387660 commit f3a49ee
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,46 @@ jobs:
os:
- windows-latest
- ubuntu-latest
- macos-latest
file:
# - ${{ github.event.repository.name }}
- bin1
- bin2
runs-on: ${{ matrix.os }}
# outputs:
# artifact-url: ${{ steps.artifact-upload-step.outputs.artifact-url }}
env:
NAME: ${{ format('target/release/{0}{1}', matrix.file, startsWith(matrix.os, 'windows') && '.exe' || '') }}
# Can't access runner context
# NEW_NAME: ${{ format('target/release/{0}-{1}-{2}{3}', matrix.file, github.ref_name, matrix.os, startsWith(matrix.os, 'windows') && '.exe' || '') }}
ARTIFACT_NAME: Binary-${{ matrix.file }}-${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Build
env:
CARGO_TERM_COLOR: always
run: cargo build --release --verbose
- name: Naming ${{ env.NEW_NAME }}
id: naming
shell: bash
env:
NEW_NAME: >-
${{ format('target/release/{0}-{1}-{2}-{3}{4}',
matrix.file, github.ref_name, runner.os, runner.arch, startsWith(matrix.os, 'windows') && '.exe' || '') }}
run: |
export NAME="$( echo ${{ env.NEW_NAME }} | tr [:upper:] [:lower:] )"
echo "FILENAME=$NAME" >> $GITHUB_OUTPUT
- name: Rename files
shell: bash
run: |
mv $NAME ${{ steps.naming.outputs.FILENAME }}
- name: Upload
uses: actions/upload-artifact@master
id: artifact-upload-step
with:
name: Binary-${{ matrix.file }}-${{ matrix.os }}
path: target/release/${{ matrix.file }}${{ runner.os == 'Windows' && '.exe' || '' }}
name: ${{ env.ARTIFACT_NAME }}
# path: ${{ env.NEW_NAME }}
path: ${{ steps.naming.outputs.FILENAME }}
# - name: Output artifact URL
# run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}'

Expand All @@ -45,18 +66,22 @@ jobs:
os:
- windows-latest
- ubuntu-latest
- macos-latest
file:
# - ${{ github.event.repository.name }}
- bin1
- bin2
runs-on: ubuntu-latest
needs: build
if: '!cancelled()' # always(), Same as success() || failure()
permissions:
contents: write
env:
ARTIFACT_NAME: Binary-${{ matrix.file }}-${{ matrix.os }}
steps:
- uses: actions/download-artifact@master
with:
name: Binary-${{ matrix.file }}-${{ matrix.os }}
name: ${{ env.ARTIFACT_NAME }}
- name: List files
run: |
ls -lih
Expand All @@ -68,4 +93,5 @@ jobs:
files: '*'
- name: Done
run: |
echo "### [${{ github.ref_name }}](https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ github.ref_name }}) Released! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "### [${{ github.ref_name }}](https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ github.ref_name }}) Released! :rocket:" \
>> $GITHUB_STEP_SUMMARY

0 comments on commit f3a49ee

Please sign in to comment.