Skip to content

Commit

Permalink
chore: unique upload, then download and combine
Browse files Browse the repository at this point in the history
  • Loading branch information
samrose committed Dec 20, 2024
1 parent ce09b8e commit de42c0e
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/dockerhub-release-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get image tag
id: get_version
run: |
Expand All @@ -155,50 +150,50 @@ jobs:
- name: Collect versions
id: collect_versions
run: |
versions=()
versions+=("${{ steps.output_version.outputs.result }}")
echo "matrix_results=[\"${versions[*]}\"]" >> $GITHUB_OUTPUT
- name: Debug matrix_results Output
run: |
echo "Debug matrix_results: '${{ steps.collect_versions.outputs.matrix_results }}'"
- name: Append Results to Artifact
run: |
echo "${{ steps.collect_versions.outputs.matrix_results }}" >> results.txt
echo "${{ steps.output_version.outputs.result }}" >> results.txt # Append results
- name: Upload Results Artifact
uses: actions/upload-artifact@v3
with:
name: merge_results
name: merge_results-${{ matrix.version }}
path: results.txt
if-no-files-found: warn
- name: Merge multi-arch manifests
run: |
docker buildx imagetools create -t ${{ steps.get_version.outputs.pg_version }} \
${{ steps.get_version.outputs.pg_version }}_amd64 \
${{ steps.get_version.outputs.pg_version }}_arm64
combine_results:
needs: merge_manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # Required if other file dependencies are in the repository
- uses: DeterminateSystems/nix-installer-action@main # Ensures Nushell is available
- name: Download Results Artifact
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- name: Download Results Artifacts
uses: actions/download-artifact@v3
with:
name: merge_results
name: merge_results-*
- name: Combine Results
id: combine
run: |
nix run nixpkgs#nushell -- -c '
let results = (open results.txt | lines | where { |line| $line != "" })
let matrix = { include: ($results | each { |ver| { version: $ver } }) }
$"matrix=($matrix | to json -r)" | save --append $env.GITHUB_OUTPUT
# Initialize an empty array to store combined results
let combined_results = []
# Loop through all downloaded result files
ls **/results.txt | each { |result_file|
let results = (open $result_file | lines | where { $it != "" })
$combined_results = $combined_results + $results
}
# Create the matrix format for the combined results
let matrix = ($combined_results | each { { version: $it } }) | to json
$"matrix=$matrix" | save --append $env.GITHUB_OUTPUT
'
- name: Debug Combined Results
run: |
echo "Combined Results: '${{ steps.combine.outputs.matrix }}'"
outputs:
matrix: ${{ steps.combine.outputs.matrix }}

publish:
needs: combine_results
strategy:
Expand Down

0 comments on commit de42c0e

Please sign in to comment.