Skip to content

Commit

Permalink
feature: support uploading ISOs to CloudFlare (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
p5 authored Nov 2, 2024
1 parent a8d2b50 commit b00265e
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/_build-iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ on:
installer-version:
required: true
type: number
upload-to-cloudflare:
required: false
type: boolean
default: false
r2-bucket:
required: false
type: string
arch:
required: false
type: string
default: x86_64

jobs:
build:
Expand Down Expand Up @@ -83,28 +94,41 @@ jobs:
uses: jasonn3/build-container-installer@a1ce6da2d6c1af0561bec053366d0f3aa7e38743 # v1.2.3
id: build-iso
with:
arch: x86_64
arch: ${{ inputs.arch }}
image_name: ${{ inputs.image-name }}
image_repo: ${{ inputs.image-registry }}
image_tag: ${{ inputs.image-tag }}
variant: Kinoite
version: ${{ inputs.installer-version }}
secure_boot_key_url: "https://github.com/rsturla/akmods/raw/main/_certs/public_key.der"
enrollment_password: "password"
iso_name: "${{ inputs.image-name }}-${{ inputs.image-tag }}.iso"
iso_name: "${{ inputs.image-name }}-${{ inputs.image-tag }}-${{ inputs.arch }}.iso"
enable_cache_dnf: false
enable_cache_skopeo: false
flatpak_remote_refs_dir: ${{ steps.flatpak-dependencies.outputs.FLATPAK_REFS_DIR }}
enable_flatpak_dependencies: false

- name: Upload ISO to GitHub
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: inputs.upload-to-cloudflare == false
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.image-name }}-${{ inputs.image-tag }}-iso
name: ${{ inputs.image-name }}-${{ inputs.image-tag }}-${{ inputs.arch }}-iso
path: |
${{ steps.build-iso.outputs.iso_path }}/${{ steps.build-iso.outputs.iso_name }}
${{ steps.build-iso.outputs.iso_path }}/${{ steps.build-iso.outputs.iso_name }}-CHECKSUM
if-no-files-found: error
retention-days: 10
compression-level: 5
overwrite: true
- name: Upload ISO to CloudFlare R2
if: inputs.upload-to-cloudflare == true
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_REGION: auto
RCLONE_CONFIG_R2_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
SOURCE_FILE: ${{ steps.build-iso.outputs.iso_path }}/${{ steps.build-iso.outputs.iso_name }}
DEST_BUCKET: ${{ inputs.r2-bucket }}
run: |
sudo apt-get update
sudo apt-get install -y rclone
rclone copy $SOURCE_FILE R2:$DEST_BUCKET

0 comments on commit b00265e

Please sign in to comment.