Skip to content

Commit

Permalink
Set version for statistics. (#27)
Browse files Browse the repository at this point in the history
* Set version for statistics.

* Try to build the hotspot version too.

* Oops, wrong section.

* typo

* Tweak the build settings.

* Delete CustomPios Submodule. Add debug info.

* More forcing of the hotspot option.

* Remove these debug steps.

* Trying to make the image names cleaner.

* Remove quotes.

* Don't use env in the name.

* Don't fail fast.
  • Loading branch information
jeffeb3 authored Aug 21, 2020
1 parent 8c35005 commit 72a7270
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 32 deletions.
75 changes: 51 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,86 @@
name: Build Image

on:
schedule:
# At 10:15 each day. No idea what time zone this is...
- cron: '15 10 * * *'

pull_request: {}
push:
tags:
- v*


release:
types:
- published

jobs:
build:

env:
V1PI_VERSION: ${{ github.event_name == 'release' && github.event.release.tag_name || 'unstable' }}

name: v1pi-build-${{ matrix.hotspot }}
runs-on: ubuntu-latest

strategy:
fail-fast: false # Allow all jobs to finish building
matrix:
hotspot:
- hotspot
- no-hotspot

steps:

- name: Update Dependencies
run: sudo apt-get update

- name: Install Dependencies
run: sudo apt install coreutils p7zip-full qemu-user-static
run: sudo apt-get install -y coreutils p7zip-full qemu-user-static

- name: Checkout CustomPiOS
uses: actions/checkout@v2
with:
repository: 'guysoft/CustomPiOS'
path: CustomPiOS

- name: Checkout Project Repository
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: repository
submodules: true

- name: Download Raspbian Image
run: cd repository/src/image && wget -q -c --trust-server-names 'https://downloads.raspberrypi.org/raspbian_lite_latest'

- name: Update CustomPiOS Paths
run: cd repository/src && ../../CustomPiOS/src/update-custompios-paths

- name: Set the hotspot mode
run: cd repository/src && echo export HOTSPOT=${{ matrix.hotspot }} > hotspot.sh

- name: Build Image
run: sudo modprobe loop && cd repository/src && sudo bash -x ./build_dist

- name: Copy Output
run: cp ${{ github.workspace }}/repository/src/workspace/*-raspbian-buster-lite.img build.img
run: cp ${{ github.workspace }}/repository/src/workspace/*-raspbian-buster-lite.img "v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}".img

- name: Zip Output
run: gzip build.img
run: zip -prq "v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}".zip "v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}".img

- uses: actions/upload-artifact@v1
with:
name: build.img.gz
path: build.img.gz
#- name: Create Release
# id: create_release
# uses: actions/create-release@latest
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
# with:
# tag_name: ${{ github.ref }}
# release_name: Release ${{ github.ref }}
#- name: Upload Release
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: build.img.gz
# asset_name: build.img.gz
# asset_content_type: application/octet-stream
name: v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}.zip
path: v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}.zip

- name: Upload img to release
if: ${{ github.event_name == 'release' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}.zip
asset_name: v1pi-${{ env.V1PI_VERSION }}-${{ matrix.hotspot }}.zip
asset_content_type: application/zip
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "dependencies/CustomPiOS"]
path = dependencies/CustomPiOS
url = https://github.com/guysoft/CustomPiOS.git
branch = CustomPiOS
[submodule "dependencies/OctoPi"]
path = dependencies/OctoPi
url = https://github.com/guysoft/OctoPi.git
Expand Down
1 change: 0 additions & 1 deletion dependencies/CustomPiOS
Submodule CustomPiOS deleted from 369d8c
15 changes: 12 additions & 3 deletions src/config
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
export DIST_NAME=V1Pi
export DIST_VERSION=0.17.0
export DIST_NAME=v1pi
export DIST_VERSION=0.17.1
export BASE_IMAGE_ENLARGEROOT=800
export MODULES="base(raspicam, network, nodejs, disable-services(octopi, cncjs), raspap, password-for-sudo)"

source ./hotspot.sh

if [[ "${HOTSPOT}" == "hotspot" ]]; then
echo "Enable Hotspot"
export MODULES="base(raspicam, network, nodejs, disable-services(octopi, cncjs), raspap, password-for-sudo)"
else
echo "Disable Hotspot"
export MODULES="base(raspicam, network, nodejs, disable-services(octopi, cncjs), password-for-sudo)"
fi
3 changes: 3 additions & 0 deletions src/modules/cncjs/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pushd /home/pi

# start it by default
update-rc.d cncjs defaults 95

# Also write this to this file, because that's what octoprint uses in their tracking statistics.
echo "$DIST_VERSION" > /etc/octopi_version
fi

if [ "$CNCJS_EDIT_HAPROXY" == "yes" ]
Expand Down

0 comments on commit 72a7270

Please sign in to comment.