Skip to content

Commit d6769a6

Browse files
committed
Use shell expansions for env vars where clearer
This uses parameter expansion, and sometimes also brace expansion, to make some commands that use environment variables shorter and easier to read. I did not apply brace expansion in the strip command run in docker, since the shell running that may be sh rather than bash.
1 parent 79f9ec0 commit d6769a6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: echo '${{ steps.release.outputs.upload_url }}' > artifacts/release-upload-url
5555

5656
- name: Save version number to artifact
57-
run: echo '${{ env.VERSION }}' > artifacts/release-version
57+
run: echo "$VERSION" > artifacts/release-version
5858

5959
- name: Upload artifacts
6060
uses: actions/upload-artifact@v4
@@ -152,9 +152,9 @@ jobs:
152152
153153
- name: Show command used for Cargo
154154
run: |
155-
echo 'cargo command is: ${{ env.CARGO }}'
156-
echo 'target flag is: ${{ env.TARGET_FLAGS }}'
157-
echo 'target dir is: ${{ env.TARGET_DIR }}'
155+
echo "cargo command is: $CARGO"
156+
echo "target flag is: $TARGET_FLAGS"
157+
echo "target dir is: $TARGET_DIR"
158158
159159
- name: Get release download URL
160160
uses: actions/download-artifact@v4
@@ -168,11 +168,12 @@ jobs:
168168
echo "VERSION=$(< artifacts/release-version)" >> "$GITHUB_ENV"
169169
170170
- name: Build release binary
171-
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} --no-default-features --features ${{ matrix.feature }}
171+
run: |
172+
"$CARGO" build --verbose --release "$TARGET_FLAGS" --no-default-features --features ${{ matrix.feature }}
172173
173174
- name: Strip release binary (linux and macos)
174175
if: matrix.build == 'linux' || matrix.build == 'macos'
175-
run: strip 'target/${{ matrix.target }}/release/ein' 'target/${{ matrix.target }}/release/gix'
176+
run: strip -- "$TARGET_DIR"/release/{ein,gix}
176177

177178
- name: Strip release binary (arm)
178179
if: matrix.build == 'linux-arm'
@@ -192,13 +193,13 @@ jobs:
192193
cp {README.md,LICENSE-*,CHANGELOG.md} "$staging/"
193194
194195
if [ '${{ matrix.os }}' = 'windows-latest' ]; then
195-
file 'target/${{ matrix.target }}/release/ein.exe' 'target/${{ matrix.target }}/release/gix.exe'
196-
cp 'target/${{ matrix.target }}/release/ein.exe' 'target/${{ matrix.target }}/release/gix.exe' "$staging/"
196+
file -- "$TARGET_DIR"/release/{ein,gix}.exe
197+
cp -- "$TARGET_DIR"/release/{ein,gix}.exe "$staging/"
197198
7z a "$staging.zip" "$staging"
198199
echo "ASSET=$staging.zip" >> "$GITHUB_ENV"
199200
else
200-
file 'target/${{ matrix.target }}/release/ein' 'target/${{ matrix.target }}/release/gix'
201-
cp 'target/${{ matrix.target }}/release/ein' 'target/${{ matrix.target }}/release/gix' "$staging/"
201+
file -- "$TARGET_DIR"/release/{ein,gix}
202+
cp -- "$TARGET_DIR"/release/{ein,gix} "$staging/"
202203
tar czf "$staging.tar.gz" "$staging"
203204
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
204205
fi

0 commit comments

Comments
 (0)