Skip to content

Commit

Permalink
Merge branch 'develop' into feat/kiauh
Browse files Browse the repository at this point in the history
  • Loading branch information
KwadFan committed Oct 20, 2023
2 parents be97913 + 660b0ba commit d6f1419
Show file tree
Hide file tree
Showing 46 changed files with 1,474 additions and 196 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/BuildImages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,53 +54,57 @@ jobs:
with:
config: ${{ matrix.config }}

- name: Copy output
id: copy-image
- name: Rename image file
id: move-image
if: always()
shell: bash
run: |
source repository/src/config
NOW="$(date +"%Y-%m-%d")"
IMAGE="${NOW}-${DIST_NAME}-${DIST_VERSION}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}"
cp repository/src/workspace/*.img $IMAGE.img
WORKSPACE=$(echo ${{ github.workspace }})
sudo chown -R $USER:$USER $WORKSPACE/repository/src/workspace || true
sudo chmod 0775 -R $WORKSPACE/repository/src/workspace || true
mv repository/src/workspace/*.img $IMAGE.img
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
- name: Upload failed Logfile
if: failure()
uses: actions/upload-artifact@v3
with:
name: failed-${{ steps.copy-image.outputs.image }}.log
name: failed-${{ steps.move-image.outputs.image }}.log
path: repository/src/build.log

- name: Compressing Image
shell: bash
run: |
CPU_COUNT="$(nproc)"
echo -e "\e[32mUsing ${CPU_COUNT} Cores for compression...\e[0m"
xz -efkvz9T"${CPU_COUNT}" ${{ steps.copy-image.outputs.image }}.img
xz -efkvz9T"${CPU_COUNT}" ${{ steps.move-image.outputs.image }}.img || true
- name: Calculating checksums
shell: bash
run: |
sha256sum ${{ steps.copy-image.outputs.image }}.img > ${{ steps.copy-image.outputs.image }}.img.sha256
sha256sum ${{ steps.copy-image.outputs.image }}.img.xz > ${{ steps.copy-image.outputs.image }}.img.xz.sha256
sha256sum ${{ steps.move-image.outputs.image }}.img > ${{ steps.move-image.outputs.image }}.img.sha256
sha256sum ${{ steps.move-image.outputs.image }}.img.xz > ${{ steps.move-image.outputs.image }}.img.xz.sha256
- name: Upload Compressed Image
uses: actions/upload-artifact@v3
with:
name: ${{ steps.copy-image.outputs.image }}.img.xz
path: ${{ steps.copy-image.outputs.image }}.img.xz
name: ${{ steps.move-image.outputs.image }}.img.xz
path: ${{ steps.move-image.outputs.image }}.img.xz

- name: Upload Compressed Image Checksum
uses: actions/upload-artifact@v3
with:
name: ${{ steps.copy-image.outputs.image }}.img.xz.sha256
path: ${{ steps.copy-image.outputs.image }}.img.xz.sha256
name: ${{ steps.move-image.outputs.image }}.img.xz.sha256
path: ${{ steps.move-image.outputs.image }}.img.xz.sha256

- name: Upload Image Checksum
uses: actions/upload-artifact@v3
with:
name: ${{ steps.copy-image.outputs.image }}.img.sha256
path: ${{ steps.copy-image.outputs.image }}.img.sha256
name: ${{ steps.move-image.outputs.image }}.img.sha256
path: ${{ steps.move-image.outputs.image }}.img.sha256
146 changes: 74 additions & 72 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
needs: [ release, matrix ]
runs-on: ubuntu-latest
outputs:
base_name: ${{ steps.copy-image.outputs.base_name }}
base_name: ${{ steps.move-image.outputs.base_name }}
strategy:
fail-fast: false
matrix:
Expand All @@ -133,35 +133,35 @@ jobs:
config: ${{ matrix.config }}
build-ref: master

- name: Copy output
id: copy-image
if: always()
- name: Upload failed Logfile
if: failure()
uses: actions/upload-artifact@v3
with:
name: failed-${{ steps.move-image.outputs.image }}.log
path: repository/src/build.log

- name: Rename image file
id: move-image
shell: bash
run: |
WORKSPACE=$(echo ${{ github.workspace }})
sudo chown -R $USER:$USER $WORKSPACE/repository/src/workspace || true
sudo chmod 0775 -R $WORKSPACE/repository/src/workspace || true
source repository/src/config
base_name="${{ needs.release.outputs.date }}-${DIST_NAME}-${DIST_VERSION}"
image="${base_name}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}"
cp repository/src/workspace/*.img $image.img
mv repository/src/workspace/*.img $image.img
echo "base_name=${base_name}" >> $GITHUB_OUTPUT
echo "image=${image}" >> $GITHUB_OUTPUT
- name: Upload failed Logfile
if: failure()
uses: actions/upload-artifact@v3
with:
name: failed-${{ steps.copy-image.outputs.image }}.log
path: repository/src/build.log

- name: Debug output
run: echo ${{ steps.copy-image.outputs.image }}

- name: Compressing Image
shell: bash
run: |
CPU_COUNT="$(nproc)"
echo -e "\e[32mUsing ${CPU_COUNT} Cores for compression...\e[0m"
xz -efkvz9T"${CPU_COUNT}" ${{ steps.copy-image.outputs.image }}.img
xz -efkvz9T"${CPU_COUNT}" ${{ steps.move-image.outputs.image }}.img || true
- name: Upload Compressing Image
if: success()
Expand All @@ -170,18 +170,18 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.release.outputs.id }}
file: ${{ steps.copy-image.outputs.image }}.img.xz
file: ${{ steps.move-image.outputs.image }}.img.xz

- name: Calculating checksums
id: checksums
shell: bash
run: |
sha256sum ${{ steps.copy-image.outputs.image }}.img > ${{ steps.copy-image.outputs.image }}.img.sha256
image_checksum=`cat ${{ steps.copy-image.outputs.image }}.img.sha256 | awk '{ print $1 }'`
sha256sum ${{ steps.move-image.outputs.image }}.img > ${{ steps.move-image.outputs.image }}.img.sha256
image_checksum=`cat ${{ steps.move-image.outputs.image }}.img.sha256 | awk '{ print $1 }'`
echo "image=${image_checksum}" >> $GITHUB_OUTPUT
sha256sum ${{ steps.copy-image.outputs.image }}.img.xz > ${{ steps.copy-image.outputs.image }}.img.xz.sha256
zip_checksum=`cat ${{ steps.copy-image.outputs.image }}.img.xz.sha256 | awk '{ print $1 }'`
sha256sum ${{ steps.move-image.outputs.image }}.img.xz > ${{ steps.move-image.outputs.image }}.img.xz.sha256
zip_checksum=`cat ${{ steps.move-image.outputs.image }}.img.xz.sha256 | awk '{ print $1 }'`
echo "zip=${zip_checksum}" >> $GITHUB_OUTPUT
- name: Upload Checksums
Expand All @@ -191,65 +191,74 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.release.outputs.id }}
file: ${{ steps.copy-image.outputs.image }}.img.sha256;${{ steps.copy-image.outputs.image }}.img.xz.sha256
file: ${{ steps.move-image.outputs.image }}.img.sha256;${{ steps.move-image.outputs.image }}.img.xz.sha256

- name: Calculating filesizes
id: filesizes
shell: bash
run: |
image_filesize=`wc -c ${{ steps.copy-image.outputs.image }}.img | awk '{print $1}'`
image_filesize=`wc -c ${{ steps.move-image.outputs.image }}.img | awk '{print $1}'`
echo "image=${image_filesize}" >> $GITHUB_OUTPUT
zip_filesize=`wc -c ${{ steps.copy-image.outputs.image }}.img.xz | awk '{print $1}'`
zip_filesize=`wc -c ${{ steps.move-image.outputs.image }}.img.xz | awk '{print $1}'`
echo "zip=${zip_filesize}" >> $GITHUB_OUTPUT
- name: Debug output
run: |
echo ${{ needs.release.outputs.id }}
echo ${{ needs.release.outputs.version }}
echo "release-id: ${{ needs.release.outputs.id }}"
echo "release-version: ${{ needs.release.outputs.version }}"
echo ${{ steps.copy-image.outputs.image }}
echo "image-name: ${{ steps.move-image.outputs.image }}"
echo ${{ steps.checksums.outputs.image }}
echo ${{ steps.checksums.outputs.zip }}
echo "checksum image: ${{ steps.checksums.outputs.image }}"
echo "checksum zip: ${{ steps.checksums.outputs.zip }}"
echo ${{ steps.filesizes.outputs.image }}
echo ${{ steps.filesizes.outputs.zip }}
echo "filesize-image: ${{ steps.filesizes.outputs.image }}"
echo "filesize-zip: ${{ steps.filesizes.outputs.zip }}"
- 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 }}"'
url: '"https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz"'
icon: '"https://os.mainsail.xyz/rpi-imager.png"'
init_format: '"systemd"'
release_date: '"${{ needs.release.outputs.date }}"'
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 }}"
extract_size: ${{ steps.filesizes.outputs.image }}
extract_sha256: '"${{ steps.checksums.outputs.image }}"'
extract_sha256: "${{ steps.checksums.outputs.image }}"
image_download_size: ${{ steps.filesizes.outputs.zip }}
image_download_sha256: '"${{ steps.checksums.outputs.zip }}"'
image_download_sha256: "${{ steps.checksums.outputs.zip }}"
with:
result-encoding: string
script: |
const { name, description, url, icon, init_format, release_date, extract_size, extract_sha256, image_download_size, image_download_sha256 } = process.env
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'
return JSON.stringify({
const json = JSON.stringify({
name,
description,
url,
icon,
init_format,
release_date,
extract_size,
extract_size: parseInt(extract_size),
extract_sha256,
image_download_size,
image_download_size: parseInt(image_download_size),
image_download_sha256
})
- name: Write JSON
run: echo "${{steps.json.outputs.result}}" > "./${{ steps.copy-image.outputs.image }}.json"
fs.writeFileSync("./${{ steps.move-image.outputs.image }}.json", json)
- name: Debug output
shell: bash
run: |
cat "./${{ steps.move-image.outputs.image }}.json"
- name: Upload JSON
if: success()
Expand All @@ -258,7 +267,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.release.outputs.id }}
file: ${{ steps.copy-image.outputs.image }}.json
file: ${{ steps.move-image.outputs.image }}.json

finish:
name: Finish Release
Expand All @@ -284,34 +293,27 @@ jobs:
fileName: "${{ needs.build.outputs.base_name }}-raspberry-*.json"
out-file-path: "downloads"

- name: Debug
run: |
ls ./downloads/*
touch rpi-imager.json
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Run script
uses: jannekem/run-python-script-action@v1
- name: Combine JSON
id: json
uses: actions/github-script@v6
with:
result-encoding: string
script: |
import os, json, shutil
with open("rpi-imager.json", "r+") as t:
t.truncate(0)
t.write('{ "os_list": [')
for filename in os.scandir('downloads'):
print(filename)
with open(filename, "r") as f:
content = f.read()
t.write(content)
t.write(',')
t.write('] }')
barak = open("rpi-imager.json", "r+")
contentb = barak.read()
print(contentb)
const downloadFolder = './downloads/'
const fs = require('fs')
const os_list = []
fs.readdirSync(downloadFolder).forEach(file => {
const raw = fs.readFileSync('./downloads/' + file, {encoding:'utf8', flag:'r'})
try {
os_list.push(JSON.parse(raw))
} catch (err) {
console.log("Error parsing JSON string:", err)
}
})
const json = JSON.stringify({os_list})
fs.writeFileSync('rpi-imager.json', json)
- name: Upload JSON
if: success()
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ All notable changes to Mainsail will be documented in this file.
- Add python3-serial CanBoot dependency (#129) | [1f59f0f](1f59f0f0db4ef653dafec0e04f18b3b08b639606)
- Add postrename module (#128) | [942896c](942896c8c9899763f64f6e58c00570584ab528e0)
- Add timelapse module (#130) | [7b99d1f](7b99d1f02fdab98a3a314cb090c1f3de6c02a203)
- Enable I2C by default (#196) | [9cebd0c](9cebd0c8545fa41a826112658dfe401b4306a2bd)
- Add Orange Pi 3 and 4 LTS (#186) | [2f556c3](2f556c3232b3d01ac48d30e08ae230cd5fda13fe)
- Add orange pi zero2 (#189) | [df2aa35](df2aa3528142f144b1c9928f90458c3a6d6c78c7)

### Bug Fixes and Improvements

- **build**: Updated download paths (#65) | [0622a2f](0622a2f60a8e39237c1fd213d67932ae6c986e08)
- **build**: Fixes error in Makefile (#76) | [0ff09b5](0ff09b5ac0503e8cee0c35a298a41a26344b57c8)
- **build**: Updated torrent download url (#90) | [a16126c](a16126c08733f96f6db7b067e7fa12d12324569b)
- **build**: Fix mv of image file (#204) | [dc8c588](dc8c588df649fd3dff86602d13d3ae3fbea31b66)
- **config.txt**: Fix configuration errors with attached screens (#119) | [81c335e](81c335eb6cb7d54de2b5433611f13dfefff2f5d7)
- **crowsnest**: Fix install of crowsnest (#111) | [e8eee5f](e8eee5fc07df000cebf3ff7379454a3efce0042b)
- **lint**: Should fix shellcheck warnings (#160) | [2569dd2](2569dd25db5c719c3e55d299062c5664c3c038b0)
Expand All @@ -43,6 +47,17 @@ All notable changes to Mainsail will be documented in this file.
- Add otg_mode=1 for CM4 in config.txt (#167) | [cb0bf60](cb0bf600e8526a79ae534a64e9fccd584eb20388)
- Fix SC2086 in armbian module (#173) | [2f4f8b1](2f4f8b13737b3f95582b9c8b824136413e9884eb)
- Fixes error setting link to macro (#175) | [d1ad3f8](d1ad3f8006ad7c9b84a9a34acc4798f15ab605e4)
- Fix shellcheck errors (#185) | [efe1b68](efe1b68d0a8cd5ccf3238d280c83ae523c331688)
- Fix syntax error in net module (#191) | [cb890af](cb890afafaa1ab6dc68fbfdc103ceca61432e064)
- Fix compress step (#205) | [fec2432](fec24320ea4bdcf51c9430e89443035b4ade70f1)
- Fix rpi-image.json workflow in Release.yml (#206) | [a03626a](a03626a54a21b1fa1175b458665ae14e9b755037)
- Remove enduser support msg from zero2 images (#209) | [4231216](42312164336966b8fabf72618f60216b6a797f04)
- Fix rpi-imager json value format for extract_size & image_download_size (#212) | [b82137c](b82137c14ea09f784478687d32a042c825af8262)
- Fix firstboot issue (#214) | [fae8b3f](fae8b3fd1f9f2b2cf2ca53e737f3862eddd62a36)
- Load `i2c-dev` modules (#217) | [6846f82](6846f82ff311299928824c8bceb606b1db13a444)
- Fix broken udev package (#224) | [b07d7a1](b07d7a103a2aad81045c26dc7223c26369ee1322)
- Fix udev for version 'rp1+deb11u2' (#226) | [b0343d5](b0343d55ddb9db0126f4fb9759e050d5fbcbb10e)
- Remove legacy cam stack (#227) | [8c65ad7](8c65ad7045bf2ada360b0f1307f599aea73d7d4f)

### Refactor

Expand All @@ -53,6 +68,8 @@ All notable changes to Mainsail will be documented in this file.
- Add `enable_auto_refresh: True` (#133) | [1b78efb](1b78efb963537a3a6dad5910ff201ba19cee2103)
- Deactivate IPv6 in nginx per default (#157) | [40b3719](40b37192608e13b4f5e97b295840715a42974fb6)
- Change behavior of piconfig module (#180) | [825af74](825af74061c48043c1ae8390c0825d2220bd623f)
- Use mv to move the image from the workspace to the root (#203) | [b7acb1e](b7acb1e49c02d2d9f50dfdc3541c10f4f2b2becc)
- Drop armbian_pkgupgrade (#210) | [799a919](799a919c2c4f2f8bf46971de88a79ab7d0bea137)

### Documentation

Expand Down Expand Up @@ -102,4 +119,7 @@ All notable changes to Mainsail will be documented in this file.
- Add "not-on-Github" bot for issues (#179) | [68520ce](68520ce40659e223d8c79820a7eda4923d9ae02d)
- Fix changelog in release workflow (#182) | [32f9429](32f9429d49671e5657c7ed5143ca63e88046f364)
- Removes fkms overlays (#183) | [999183b](999183bef6b290efcd8d4f2c8d708354152d411c)
- Remove unattended-upgrades service (#215) | [9f09363](9f093631d22b4cb00cc57601ed55bc51e23e40e0)
- Revert firstboot fix (#219) | [02e0100](02e01006c7d1d84efcaee6fb7a64045084ed8667)
- Update crowsnest module (#221) | [726239c](726239ca7db82c3867af3c28785cae0ca7b2e3eb)

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Learn more about:

## How to install MainsailOS ?

You can find detailed instructions in our [documentation](https://docs.mainsail.xyz/setup/mainsail-os).
You can find detailed instructions in our [documentation](https://docs-os.mainsail.xyz).

We recommend the installation via [Raspberry Pi Imager](https://docs.mainsail.xyz/setup/mainsailos/pi-imager).
We recommend the installation via [Raspberry Pi Imager](https://docs-os.mainsail.xyz/getting-started/raspberry-pi-os-based).

## How to get help?

Expand All @@ -34,9 +34,9 @@ Also see the [FAQ](#faq) section.

Here a list of included and preinstalled Software:

- [Klipper (3D Printer Firmware)](https://github.com/KevinOConnor/klipper)
- [Klipper (3D Printer Firmware)](https://github.com/Klipper3d/klipper)
- [Moonraker (API Web Server for Klipper)](https://github.com/Arksine/moonraker)
- [Mainsail (Web interface for Klipper/Moonraker)](https://github.com/meteyou/mainsail)
- [Mainsail (Web interface for Klipper/Moonraker)](https://github.com/mainsail-crew/mainsail)
- [Crowsnest (Webcam streaming)](https://github.com/mainsail-crew/crowsnest)
- [Sonar (Keepalive daemon)](https://github.com/mainsail-crew/sonar)
- [Nginx (Webserver & Proxy)](https://nginx.org/en/)
Expand Down
Loading

0 comments on commit d6f1419

Please sign in to comment.