Skip to content

Commit e133a89

Browse files
committed
fix(ci): correct shell usage and artifact path in release workflow
This commit addresses two issues in the release workflow (`release.yml`): 1. **Remove invalid `shell:` key usage:** The "Package release artifacts" step incorrectly tried to use `${{ matrix.archive_shell }}` for the `shell:` key. This key requires a predefined shell keyword, not a runtime expression. The step now relies on the runner's default shell (bash/pwsh), which matches the required shells for the archive commands. 2. **Fix artifact upload path:** The `ARCHIVE_NAME` variable, set dynamically via `$GITHUB_ENV`, was not accessible using `${{ env.ARCHIVE_NAME }}` in the `actions/upload-artifact` step's `path` input. The "Prepare archive name" step now also sets a step output (`archive_filename`), and the upload step uses this output (`${{ steps.prepare_archive_name.outputs.archive_filename }}`) to correctly specify the artifact path.
1 parent 6b802ad commit e133a89

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ jobs:
7171
run: cargo build --release --target ${{ matrix.target }} --verbose
7272

7373
- name: Prepare archive name
74-
run: echo "ARCHIVE_NAME=${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive_format }}" >> $GITHUB_ENV
74+
id: prepare_archive_name # Add an ID to the step
75+
run: |
76+
# Calculate the filename
77+
archive_filename="${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive_format }}"
78+
# Set environment variable for subsequent run steps (like packaging)
79+
echo "ARCHIVE_NAME=${archive_filename}" >> $GITHUB_ENV
80+
# Set step output for use in action inputs (like upload-artifact path)
81+
echo "::set-output name=archive_filename::${archive_filename}"
7582
shell: bash
7683

7784
- name: Create staging directory
@@ -98,13 +105,14 @@ jobs:
98105

99106
- name: Package release artifacts from staging directory
100107
run: ${{ matrix.archive_command }}
101-
shell: ${{ matrix.archive_shell }}
108+
# No shell: key needed
102109

103110
- name: Upload release asset
104111
uses: actions/upload-artifact@v4
105112
with:
106113
name: release-assets
107-
path: ${{ env.ARCHIVE_NAME }}
114+
# Use the output from the 'prepare_archive_name' step
115+
path: ${{ steps.prepare_archive_name.outputs.archive_filename }}
108116

109117
create-release:
110118
name: Create GitHub Release

0 commit comments

Comments
 (0)