-
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.
Add channel input to upload to manifest-beta.json (#86)
- Loading branch information
1 parent
f0a69bd
commit bdc5cee
Showing
1 changed file
with
42 additions
and
2 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 |
---|---|---|
|
@@ -15,6 +15,11 @@ on: | |
required: false | ||
type: string | ||
default: "" | ||
channel: | ||
description: Channel to upload to. "beta" or "production" | ||
required: false | ||
type: string | ||
default: "production" | ||
|
||
jobs: | ||
upload: | ||
|
@@ -38,13 +43,13 @@ jobs: | |
source-dir: files | ||
destination-dir: ${{ inputs.directory }}/ | ||
|
||
promote: | ||
promote-prod: | ||
name: Promote firmware to production | ||
needs: | ||
- upload | ||
runs-on: ubuntu-latest | ||
environment: production | ||
if: inputs.version != '' | ||
if: inputs.version != '' && inputs.channel == 'production' | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/[email protected] | ||
|
@@ -72,3 +77,38 @@ jobs: | |
r2-bucket: ${{ secrets.CLOUDFLARE_R2_BUCKET }} | ||
source-dir: output | ||
destination-dir: ${{ inputs.directory }}/ | ||
|
||
promote-beta: | ||
name: Promote firmware to beta | ||
needs: | ||
- upload | ||
runs-on: ubuntu-latest | ||
environment: beta | ||
if: inputs.version != '' | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/[email protected] | ||
with: | ||
path: files | ||
|
||
- name: Copy manifest.json | ||
run: | | ||
mkdir -p output | ||
version="${{ inputs.version }}" | ||
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-beta.json | ||
done | ||
- name: Upload files to R2 | ||
uses: ryand56/[email protected] | ||
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 }}/ |