Skip to content

Commit

Permalink
s3 bucket upload edit qw
Browse files Browse the repository at this point in the history
  • Loading branch information
ebelfarsi committed Jul 12, 2024
1 parent a5a334f commit 8655a1e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/package-manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,35 +50,36 @@ 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/releases/output.json
- name: Prepare Directory Structure
shell: bash
run: |
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}"
version=$(jq -r '.[0].Version' "$output_json_path" | cut -d'-' -f1)
base_dir="${{ github.workspace }}/CE-Candidate-${version}"
# Create base directory if it doesn't exist
mkdir -p "$base_dir"
# Parse JSON and create directory structure
jq -r '.[] | .Edge_Cast_Path' "$output_json_path" | while read path; do
full_path="${{ github.workspace }}/$path"
full_path="$base_dir/$(echo $path | sed 's#releases/CE-Candidate-[^/]*##')"
mkdir -p "$(dirname "$full_path")"
touch "$full_path"
done
# Rename and move output.json to manifests_versionnumber_meta_data.json in the base directory
mv "$output_json_path" "$base_dir/manifests_${version}_meta_data.json"
- name: Sync Directory to S3 Bucket
shell: bash
run: |
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/
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/releases/CE-Candidate-${version}/

- name: Upload output.json to GitHub Release
uses: ncipollo/[email protected]
Expand Down

0 comments on commit 8655a1e

Please sign in to comment.