-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update generate json to new format (#266)
* chore: update generate json to new format Signed-off-by: Stephan Wendel <[email protected]> * fix: fix process.env Signed-off-by: Stephan Wendel <[email protected]> * fix: fix typo and fix globbing Signed-off-by: Stephan Wendel <[email protected]> * fix: fix json output Signed-off-by: Stephan Wendel <[email protected]> * fix: fix variable typo Signed-off-by: Stephan Wendel <[email protected]> * fix: convert json to string Signed-off-by: Stephan Wendel <[email protected]> * fix: fix json array output Signed-off-by: Stephan Wendel <[email protected]> * ci(release): fix syntax to generate json Signed-off-by: Stefan Dej <[email protected]> * ci(release): fix output name in json Signed-off-by: Stefan Dej <[email protected]> * ci(release): build rpi-imager.json with all json files Signed-off-by: Stefan Dej <[email protected]> * ci(release): fix typo in generate json Signed-off-by: Stefan Dej <[email protected]> * ci(release): remove empty strings from devices array Signed-off-by: Stefan Dej <[email protected]> * chore: remove rpi3 from json list Signed-off-by: Stephan Wendel <[email protected]> --------- Signed-off-by: Stephan Wendel <[email protected]> Signed-off-by: Stefan Dej <[email protected]> Co-authored-by: Stefan Dej <[email protected]>
- Loading branch information
Showing
11 changed files
with
98 additions
and
17 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 |
---|---|---|
|
@@ -219,41 +219,59 @@ jobs: | |
echo "filesize-image: ${{ steps.filesizes.outputs.image }}" | ||
echo "filesize-zip: ${{ steps.filesizes.outputs.zip }}" | ||
- name: Get JSON data | ||
id: json-data | ||
shell: bash | ||
run: | | ||
source repository/src/config | ||
if [[ -n "${BASE_ARCH}" ]]; then | ||
type="64-bit" | ||
else | ||
type="32-bit" | ||
fi | ||
name="${JSON_PRETTY_NAME} ${{ github.event.inputs.version }}" | ||
name="${name} - ${JSON_PRETTY_SBC_NAME}" | ||
name="${name} (${type})" | ||
echo "pretty_name=${name}" >> $GITHUB_OUTPUT | ||
echo "description=${JSON_DESCRIPTION}" >> $GITHUB_OUTPUT | ||
echo "icon_url=${JSON_ICON_URL}" >> $GITHUB_OUTPUT | ||
echo "init_format=${JSON_INIT_FORMAT}" >> $GITHUB_OUTPUT | ||
echo "supported_sbc=${JSON_SUPPORTED_SBC}" >> $GITHUB_OUTPUT | ||
- name: Generate JSON | ||
id: json | ||
uses: actions/github-script@v6 | ||
env: | ||
name: "Mainsail OS ${{ github.event.inputs.version }}" | ||
description: "Type: ${{ steps.build.outputs.type }}, SBC: ${{ steps.build.outputs.sbc }}" | ||
type: "${{ steps.build.outputs.type }}" | ||
sbc: "${{ steps.build.outputs.sbc }}" | ||
url: "https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.move-image.outputs.image }}.img.xz" | ||
icon: "https://os.mainsail.xyz/rpi-imager.png" | ||
init_format: "systemd" | ||
release_date: "${{ needs.release.outputs.date }}" | ||
name: "${{ steps.json-data.outputs.pretty_name }}" | ||
description: "${{ steps.json-data.outputs.description }}" | ||
icon: "${{ steps.json-data.outputs.icon_url }}" | ||
url: "https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/${{ steps.move-image.outputs.image }}.img.xz" | ||
extract_size: ${{ steps.filesizes.outputs.image }} | ||
extract_sha256: "${{ steps.checksums.outputs.image }}" | ||
image_download_size: ${{ steps.filesizes.outputs.zip }} | ||
image_download_sha256: "${{ steps.checksums.outputs.zip }}" | ||
release_date: "${{ needs.release.outputs.date }}" | ||
init_format: "${{ steps.json-data.outputs.init_format }}" | ||
supported_sbc: ${{ steps.json-data.outputs.supported_sbc }} | ||
with: | ||
result-encoding: string | ||
script: | | ||
const fs = require('fs') | ||
let { name, description, type, sbc, url, icon, init_format, release_date, extract_size, extract_sha256, image_download_size, image_download_sha256 } = process.env | ||
if (sbc === 'rpi32') name += ' 32-Bit (recommend)' | ||
else if (sbc === 'rpi64') name += ' 64-Bit' | ||
const { name, description, icon, url, extract_size, extract_sha256, image_download_size, release_date, init_format, supported_sbc } = process.env | ||
const json = JSON.stringify({ | ||
name, | ||
description, | ||
url, | ||
icon, | ||
init_format, | ||
release_date, | ||
url, | ||
extract_size: parseInt(extract_size), | ||
extract_sha256, | ||
image_download_size: parseInt(image_download_size), | ||
image_download_sha256 | ||
release_date, | ||
init_format, | ||
devices: supported_sbc.split(" ").filter((item) => item != '') | ||
}) | ||
fs.writeFileSync("./${{ steps.move-image.outputs.image }}.json", json) | ||
|
@@ -293,7 +311,7 @@ jobs: | |
uses: robinraju/[email protected] | ||
with: | ||
tag: ${{ github.event.inputs.version }} | ||
fileName: "${{ needs.build.outputs.base_name }}-raspberry-*.json" | ||
fileName: "${{ needs.build.outputs.base_name }}-*.json" | ||
out-file-path: "downloads" | ||
|
||
- name: Combine JSON | ||
|
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
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
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
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
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
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
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
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
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
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