# .github/actions/upload-artifacts/action.yml name: 'Upload Artifacts' description: 'Archives and uploads signed binaries to a GitHub release' inputs: chain-network: required: true description: 'The chain network name to use in filenames, mainnet or testnet' assets: description: "A \\n separated string list of filenames to archive; if asset is a abs path, it's respected" required: false asset-type: required: true description: 'The asset type: cli, gui, ANYTHING; used as a separator for different release packages for the same arch' asset-directory: required: true description: "The directory where 7z's working dir will be set" runs: using: "composite" steps: - name: compute file name id: asset shell: bash run: | ARCH=${{ runner.arch }} RUNNER_OS=${{ runner.os }} LOWERCASE_ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]') TARGET_OS=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') FILENAME="${{ inputs.chain-network }}-${{ inputs.asset-type }}-${TARGET_OS}-${LOWERCASE_ARCH}" echo "key=$FILENAME" >> $GITHUB_OUTPUT # Format the output to be a multi-line string. # This is the correct way to pass a multi-line string in GITHUB_OUTPUT. echo "paths<> "$GITHUB_OUTPUT" # Iterate through each filename echo "${{ inputs.assets }}" | while read -r file; do if [[ -z "$file" ]]; then continue fi # Check if the file is an absolute path if [[ "$file" == /* ]] || [[ "$file" =~ ^[a-zA-Z]: ]]; then FULL_PATH="$file" else # It's a relative path, so join it with the asset directory if [[ "${{ runner.os }}" == "Windows" ]]; then FULL_PATH="${{ inputs.asset-directory }}\\$file" else FULL_PATH="${{ inputs.asset-directory }}/$file" fi fi echo "$FULL_PATH" >> "$GITHUB_OUTPUT" done echo "EOF" >> "$GITHUB_OUTPUT" - name: Upload Artifacts uses: actions/upload-artifact@v4.6.2 with: name: ${{ steps.asset.outputs.key }} path: ${{ steps.asset.outputs.paths }}