-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split r2 job into upload and promote (#102)
- Loading branch information
1 parent
5a02c81
commit c0709c3
Showing
2 changed files
with
59 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Promote firmware on Cloudflare R2 | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: Version of the firmware to promote | ||
required: true | ||
type: string | ||
directory: | ||
description: Directory to promote the firmware to | ||
required: true | ||
type: string | ||
channel: | ||
description: Channel to upload to. "beta" or "production" | ||
required: false | ||
type: string | ||
default: "production" | ||
manifest-filename: | ||
description: Filename of the manifest to write. | ||
required: false | ||
type: string | ||
default: manifest.json | ||
|
||
jobs: | ||
promote: | ||
name: Promote ${{ inputs.version }} to ${{ inputs.channel }} | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.channel }} | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4.1.8 | ||
with: | ||
path: files | ||
|
||
- name: Build ${{ inputs.manifest-filename }} | ||
run: | | ||
mkdir -p output | ||
version="${{ inputs.version }}" | ||
manifest_filename="${{ inputs.manifest-filename }}" | ||
for device in files/*; do | ||
device=$(basename $device) | ||
mkdir -p output/$device | ||
jq --arg version "$version" \ | ||
'.builds[].ota.path |= $version + "/" + . | (.builds[].parts // [])[].path |= $version + "/" + .' \ | ||
files/$device/$version/manifest.json > output/$device/$manifest_filename.json | ||
done | ||
- name: Upload ${{ inputs.manifest-filename }} to R2 | ||
uses: ryand56/r2-upload-action@v1.4 | ||
with: | ||
r2-account-id: ${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }} | ||
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }} | ||
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }} | ||
r2-bucket: ${{ secrets.CLOUDFLARE_R2_BUCKET }} | ||
source-dir: output | ||
destination-dir: ${{ inputs.directory }}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters