Skip to content

Commit

Permalink
Use trust relationship for S3 authentication
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Sørlie <[email protected]>
  • Loading branch information
SuperManifolds committed Feb 11, 2025
1 parent 3caac3c commit b20de11
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/hydrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@ jobs:
uses: actions/download-artifact@v4
with:
path: /tmp/out
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Publish pre-release to GitHub releases
if: ${{ github.ref == 'refs/heads/main-live-migration-pvm' || github.ref == 'refs/heads/main-live-migration' || github.ref == 'refs/heads/firecracker-v1.8-live-migration-pvm' || github.ref == 'refs/heads/firecracker-v1.8-live-migration' }}
uses: softprops/action-gh-release@v2
with:
tag_name: release-${{ steps.extract_branch.outputs.branch }}
tag_name: release-${{ github.ref_name }}
prerelease: true
files: |
/tmp/out/*/*
Expand All @@ -96,22 +93,25 @@ jobs:
files: |
/tmp/out/*/*
- name: Extract tag name (if exists)
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
- name: Configure AWS Credentials (only if running on a tag)
if: startsWith(github.ref, 'refs/tags/v')
uses: aws-actions/configure-aws-credentials@v2
- name: "Configure AWS credentials"
uses: "aws-actions/configure-aws-credentials@v4"
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
aws-region: "${{ vars.AWS_REGION }}"
role-to-assume: "${{ vars.AWS_IAM_ROLE }}"
role-session-name: "firecracker-hydrun-${{ github.job }}-${{ github.run_id }}"
role-duration-seconds: 10800 # 3h

- name: Upload to S3 (only if running on a tag)
if: startsWith(github.ref, 'refs/tags/')
- name: Upload to S3
if: "!startsWith(github.ref, 'refs/pull/')"
run: |
aws s3 cp /tmp/out ${{ vars.S3_BUCKET_URL }}${{ env.TAG_NAME }}/ --recursive
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
UPLOAD_FOLDER="release/${GITHUB_REF#refs/tags/}"
elif [[ "${{ github.ref }}" == refs/heads/* ]]; then
UPLOAD_FOLDER="dev/${GITHUB_REF#refs/heads/}"
else
echo "Skipping S3 upload: unsupported ref type $GITHUB_REF"
exit 0
fi
echo "Uploading artifacts to: ${{ vars.S3_BUCKET_URL }}firecracker/${UPLOAD_FOLDER}/"
aws s3 cp /tmp/out ${{ vars.S3_BUCKET_URL }}firecracker/${UPLOAD_FOLDER}/ --recursive

0 comments on commit b20de11

Please sign in to comment.