Skip to content

Commit 5656b38

Browse files
committed
fix(ci): resolve artifact conflicts and deprecation warnings in release workflow
This commit addresses two issues in the release workflow (`release.yml`): 1. **Artifact Upload Conflict (409):** The `build-release` jobs were failing with a 409 Conflict error because they all tried to upload an artifact with the same name (`release-assets`). This is resolved by giving each uploaded artifact a unique name based on the build target (`release-asset-${{ matrix.target }}`). The `create-release` job is updated to download all artifacts from the run, ensuring all binaries are collected before creating the GitHub Release. 2. **`set-output` Deprecation:** The workflow used the deprecated `::set-output` command to set the `archive_filename` step output. This has been updated to use the recommended method of writing to the `$GITHUB_OUTPUT` environment file, resolving the deprecation warnings.
1 parent e133a89 commit 5656b38

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
archive_format: tar.gz
2828
archive_command: |
2929
tar czf "$ARCHIVE_NAME" -C "$STAGING_DIR" .
30-
archive_shell: bash
30+
archive_shell: bash # Keep for reference, but not used in shell: key
3131

3232
# macOS (Intel x86_64) - tar.gz archive
3333
- os: macos-latest
@@ -36,7 +36,7 @@ jobs:
3636
archive_format: tar.gz
3737
archive_command: |
3838
tar czf "$ARCHIVE_NAME" -C "$STAGING_DIR" .
39-
archive_shell: bash
39+
archive_shell: bash # Keep for reference, but not used in shell: key
4040

4141
# macOS (Apple Silicon arm64) - tar.gz archive
4242
- os: macos-14
@@ -45,7 +45,7 @@ jobs:
4545
archive_format: tar.gz
4646
archive_command: |
4747
tar czf "$ARCHIVE_NAME" -C "$STAGING_DIR" .
48-
archive_shell: bash
48+
archive_shell: bash # Keep for reference, but not used in shell: key
4949

5050
# Windows (MSVC x86_64) - zip archive
5151
- os: windows-latest
@@ -54,7 +54,7 @@ jobs:
5454
archive_format: zip
5555
archive_command: |
5656
Compress-Archive -Path "$($env:STAGING_DIR)\*" -DestinationPath "$env:ARCHIVE_NAME"
57-
archive_shell: pwsh
57+
archive_shell: pwsh # Keep for reference, but not used in shell: key
5858

5959
steps:
6060
- name: Checkout repository
@@ -71,14 +71,14 @@ jobs:
7171
run: cargo build --release --target ${{ matrix.target }} --verbose
7272

7373
- name: Prepare archive name
74-
id: prepare_archive_name # Add an ID to the step
74+
id: prepare_archive_name # Step ID remains
7575
run: |
7676
# Calculate the filename
7777
archive_filename="${{ env.BINARY_NAME }}-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive_format }}"
7878
# Set environment variable for subsequent run steps (like packaging)
7979
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}"
80+
# Set step output using the new method for use in action inputs
81+
echo "archive_filename=${archive_filename}" >> $GITHUB_OUTPUT
8282
shell: bash
8383

8484
- name: Create staging directory
@@ -105,12 +105,13 @@ jobs:
105105

106106
- name: Package release artifacts from staging directory
107107
run: ${{ matrix.archive_command }}
108-
# No shell: key needed
108+
# No shell: key needed here
109109

110110
- name: Upload release asset
111111
uses: actions/upload-artifact@v4
112112
with:
113-
name: release-assets
113+
# Use a unique name for each artifact based on the target
114+
name: release-asset-${{ matrix.target }}
114115
# Use the output from the 'prepare_archive_name' step
115116
path: ${{ steps.prepare_archive_name.outputs.archive_filename }}
116117

@@ -123,8 +124,8 @@ jobs:
123124
- name: Download all release assets
124125
uses: actions/download-artifact@v4
125126
with:
126-
name: release-assets
127-
path: release-assets
127+
# No 'name' specified, download all artifacts from the run
128+
path: release-assets # All downloaded artifacts will land here
128129

129130
- name: List downloaded files (for debugging)
130131
run: ls -R release-assets
@@ -135,6 +136,7 @@ jobs:
135136
tag_name: ${{ github.ref_name }}
136137
name: Release ${{ github.ref_name }}
137138
generate_release_notes: true
139+
# This glob will now find all the archive files downloaded into release-assets
138140
files: release-assets/*
139141
env:
140142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)