Skip to content

Commit

Permalink
s3 bucket upload edit xs
Browse files Browse the repository at this point in the history
  • Loading branch information
ebelfarsi committed Jul 12, 2024
1 parent 45d801d commit a5a334f
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/package-manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,35 @@ jobs:
- name: Fetch Output from Container and Upload to S3
run: |
docker cp package-container:/app/output.json ${{ github.workspace }}/output.json
aws s3 cp ${{ github.workspace }}/output.json s3://ebelfarsi-bucket/output.json
aws s3 cp ${{ github.workspace }}/output.json s3://ebelfarsi-bucket/releases/output.json
- name: Prepare Directory Structure
shell: bash
run: |
version=$(jq -r '.[0].Version' ${{ github.workspace }}/output.json | cut -d'-' -f1)
base_dir="${{ github.workspace }}/CE-Candidate-${version}"
output_json_path="${{ github.workspace }}/output.json"
# Extract version number from the first entry
version=$(jq -r '.[0].Version' "$output_json_path")
base_dir="${{ github.workspace }}/releases/CE-Candidate-${version}"
# Create base directory if it doesn't exist
mkdir -p "$base_dir"
jq -r '.[] | .Edge_Cast_path' ${{ github.workspace }}/output.json | while read path; do
full_path="$base_dir/$(echo $path | sed 's#releases/CE-Candidate-[^/]*##')"
# Parse JSON and create directory structure
jq -r '.[] | .Edge_Cast_Path' "$output_json_path" | while read path; do
full_path="${{ github.workspace }}/$path"
mkdir -p "$(dirname "$full_path")"
touch "$full_path"
done
- name: Sync Directory to S3 Bucket
shell: bash
run: |
version=$(jq -r '.[0].Version' ${{ github.workspace }}/output.json | cut -d'-' -f1)
base_dir="${{ github.workspace }}/CE-Candidate-${version}"
aws s3 sync "$base_dir" s3://ebelfarsi-bucket/
output_json_path="${{ github.workspace }}/output.json"
version=$(jq -r '.[0].Version' "$output_json_path")
base_dir="${{ github.workspace }}/releases/CE-Candidate-${version}"
aws s3 sync "$base_dir" s3://ebelfarsi-bucket/releases/
- name: Upload output.json to GitHub Release
uses: ncipollo/[email protected]
Expand Down

0 comments on commit a5a334f

Please sign in to comment.