Skip to content

Commit

Permalink
chore(ci): Add R2 secrets logic to upload to different buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmiller committed Apr 10, 2024
1 parent 73744b1 commit 293d5cf
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/reusable-build-iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,38 @@ jobs:
compression-level: 0
overwrite: true

- name: Determine R2 Secrets
id: r2-secrets
shell: bash
run: |
if [[ ${{ inputs.brand_name }} = "bluefin" ]]; then
RCLONE_CONFIG_R2_ACCESS_KEY_ID=${{ secrets.R2_ACCESS_KEY_ID }}
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY=${{ secrets.R2_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_R2_ENDPOINT=${{ secrets.R2_ENDPOINT }}
BUCKET_PATH="R2:bluefin"
elif [[ ${{ inputs.brand_name }} = "aurora" ]]; then
RCLONE_CONFIG_R2_ACCESS_KEY_ID=${{ secrets.AURORA_R2_ACCESS_KEY_ID }}
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY=${{ secrets.AURORA_R2_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_R2_ENDPOINT=${{ secrets.AURORA_R2_ENDPOINT }}
BUCKET_PATH="R2:aurora-dl"
fi
echo "rclone-config-r2-access-key-id=${RCLONE_CONFIG_R2_ACCESS_KEY_ID}" >> $GITHUB_OUTPUT
echo "rclone-config-r2-secret-access-key=${RCLONE_CONFIG_R2_SECRET_ACCESS_KEY}" >> $GITHUB_OUTPUT
echo "rclone-config-r2-endpoint=${RCLONE_CONFIG_R2_ENDPOINT}" >> $GITHUB_OUTPUT
echo "bucket-path=${BUCKET_PATH}" >> $GITHUB_OUTPUT
- name: Upload ISOs and Checksum to R2
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main'
shell: bash
env:
RCLONE_CONFIG_R2_TYPE: s3
RCLONE_CONFIG_R2_PROVIDER: Cloudflare
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ steps.r2-secrets.outputs.rclone-config-r2-access-key-id }}
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ steps.r2-secrets.outputs.rclone-config-r2-secret-access-key }}
RCLONE_CONFIG_R2_REGION: auto
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
RCLONE_CONFIG_R2_ENDPOINT: ${{ steps.r2-secrets.outputs.rclone-config-r2-endpoint }}
SOURCE_DIR: ${{ steps.upload-directory.outputs.iso-upload-dir }}
run: |
sudo apt-get update
sudo apt-get install -y rclone
rclone copy $SOURCE_DIR R2:bluefin
rclone copy $SOURCE_DIR ${{ steps.r2-secrets.outputs.bucket-path }}

0 comments on commit 293d5cf

Please sign in to comment.