Skip to content

Commit

Permalink
fix: artifacts.yml action (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci authored Aug 1, 2024
1 parent 11e33f9 commit c270dda
Showing 1 changed file with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ jobs:
- name: Upload Artifact to AWS S3
run: |
aws s3 cp ${{ env.ARTIFACT_NAME }} s3://${{ secrets.AWS_S3_BUCKET }}
- name: Set Artifact Retention
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
aws s3api put-object-tagging \
--bucket ${{ secrets.AWS_S3_BUCKET }} \
--key "${{ env.ARTIFACT_NAME }}" \
Expand All @@ -56,10 +52,6 @@ jobs:
module: [ infrastructure/tools/keystore-generator, p2p/integrationtest/real-bidder, p2p/integrationtest/provider, bridge/standard/bridge-v1, external/geth, oracle, p2p]

steps:
- name: Set Snapshot Flag
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "FLAGS=--snapshot" >> ${GITHUB_ENV}

- name: Checkout Code
uses: actions/checkout@v4
with:
Expand All @@ -86,7 +78,7 @@ jobs:
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --config=./${{ matrix.module }}/.goreleaser.yml --clean ${{ env.FLAGS }}
args: release --config=./${{ matrix.module }}/.goreleaser.yml --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -99,19 +91,13 @@ jobs:

- name: Upload Artifacts to AWS S3
run: |
aws s3 cp ./dist/ s3://${{ secrets.AWS_S3_BUCKET }} \
--recursive \
--exclude "*" \
--include "*.gz" \
--include "*.txt" \
- name: Set Artifacts Retention
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
ls -1 ./dist | grep '\.gz\|\.txt$' | while read -r file; do
echo "Tagging uploaded file $file for auto delete"
aws s3api put-object-tagging \
--bucket ${{ secrets.AWS_S3_BUCKET }} \
--key "$file" \
--tagging 'TagSet=[{Key=AutoDelete,Value=true}]'
done
find /tmp/dist -type f \( -name "*.gz" -o -name "*.txt" \) \
-exec sh -c '
file=$(basename "${1}")
echo "Uploading ${file} to S3..."
aws s3 cp "${1}" s3://${{ secrets.AWS_S3_BUCKET }}/ &&
aws s3api put-object-tagging \
--bucket ${{ secrets.AWS_S3_BUCKET }} \
--key "${file}" \
--tagging "TagSet=[{Key=AutoDelete,Value=true}]"
' _ {} \;

0 comments on commit c270dda

Please sign in to comment.