Skip to content

Commit 023d464

Browse files
committed
update workflow file
1 parent bee15d2 commit 023d464

File tree

1 file changed

+33
-25
lines changed

1 file changed

+33
-25
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,46 @@ jobs:
2222
- name: Install Rust toolchain
2323
uses: dtolnay/rust-toolchain@stable
2424

25+
- name: Install ALSA development libraries (Linux)
26+
if: matrix.os == 'ubuntu-latest'
27+
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
28+
2529
- name: Build
2630
run: cargo build --release --locked
2731

28-
- name: Prepare artifacts for Windows
29-
if: matrix.os == 'windows-latest'
30-
run: |
31-
mv target/release/ascii-rs.exe target/release/ascii-rs-windows-${{ github.ref }}.exe
32-
shell: bash
33-
34-
- name: Prepare artifacts for Linux
35-
if: matrix.os == 'ubuntu-latest'
36-
run: |
37-
mv target/release/ascii-rs target/release/ascii-rs-ubuntu-${{ github.ref }}
32+
- name: Prepare release assets
33+
id: prep
3834
shell: bash
35+
run: |
36+
VERSION=${{ github.ref_name }}
37+
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
38+
VERSION="nightly"
39+
fi
3940
40-
- name: Prepare artifacts for macOS
41-
if: matrix.os == 'macos-latest'
42-
run: |
43-
mv target/release/ascii-rs target/release/ascii-rs-macos-${{ github.ref }}
44-
shell: bash
41+
ASSET_PATH=""
42+
ASSET_NAME=""
43+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
44+
src="target/release/ascii-rs.exe"
45+
ASSET_NAME="ascii-rs-windows-${VERSION}.exe"
46+
mv "${src}" "${ASSET_NAME}"
47+
ASSET_PATH="${ASSET_NAME}"
48+
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
49+
src="target/release/ascii-rs"
50+
ASSET_NAME="ascii-rs-linux-${VERSION}"
51+
mv "${src}" "${ASSET_NAME}"
52+
ASSET_PATH="${ASSET_NAME}"
53+
else
54+
src="target/release/ascii-rs"
55+
ASSET_NAME="ascii-rs-macos-${VERSION}"
56+
mv "${src}" "${ASSET_NAME}"
57+
ASSET_PATH="${ASSET_NAME}"
58+
fi
59+
echo "ASSET_PATH=${ASSET_PATH}" >> $GITHUB_OUTPUT
4560
46-
- name: Upload artifacts
61+
- name: Upload artifact
4762
uses: actions/upload-artifact@v4
4863
with:
49-
name: ascii-rs-${{ matrix.os }}
50-
path: |
51-
target/release/ascii-rs-ubuntu-${{ github.ref }}
52-
target/release/ascii-rs-windows-${{ github.ref }}.exe
53-
target/release/ascii-rs-macos-${{ github.ref }}
64+
path: ${{ steps.prep.outputs.ASSET_PATH }}
5465

5566
create-release:
5667
name: Create Release
@@ -66,7 +77,4 @@ jobs:
6677
uses: softprops/action-gh-release@v2
6778
with:
6879
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
69-
files: |
70-
artifacts/ascii-rs-ubuntu-${{ github.ref }}/ascii-rs-ubuntu-${{ github.ref }}
71-
artifacts/ascii-rs-windows-${{ github.ref }}.exe/ascii-rs-windows-${{ github.ref }}.exe
72-
artifacts/ascii-rs-macos-${{ github.ref }}/ascii-rs-macos-${{ github.ref }}
80+
files: artifacts/*/*

0 commit comments

Comments
 (0)