Skip to content

Commit

Permalink
Package code as deb package / systemd service
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 78eb929
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 22:06:47 2022 -0800

    Add patch to action

commit 98ace9e
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 21:56:06 2022 -0800

    Fix deb file name

commit 9facc6b
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 21:54:38 2022 -0800

    Change deb file name

commit a73a1dd
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 21:14:20 2022 -0800

    Fix deb package name

commit 6c6aae9
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 21:06:50 2022 -0800

    Fix package name

commit 1ba2013
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 21:04:44 2022 -0800

    Fix workflow ref usage

commit 4df5a6e
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 20:58:32 2022 -0800

    Fix tag reference

commit b9a1951
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 20:52:17 2022 -0800

    Fix workflow

commit 8ef8609
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 20:49:39 2022 -0800

    Add deb packaging to workflow

commit 7864fe2
Author: Charlie King <[email protected]>
Date:   Sun Jan 2 20:49:26 2022 -0800

    Add systemd unit file
  • Loading branch information
cha-king committed Jan 3, 2022
1 parent 67fd7bd commit 3d53d5d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,32 @@ jobs:
uses: actions/checkout@v2
- name: Build
run: GOARCH=arm GOARM=6 GOOS=linux go build
- name: Upload binary

- name: Package code
run: |
mkdir light-controller_${{ github.ref_name }}_armv6l
mkdir -p light-controller_${{ github.ref_name }}_armv6l/usr/local/bin
mkdir -p light-controller_${{ github.ref_name }}_armv6l/etc/systemd/system
cp light-controller light-controller_${{ github.ref_name }}_armv6l/usr/local/bin/
cp light-controller.service light-controller_${{ github.ref_name }}_armv6l/etc/systemd/system/
- name: Package deb
id: package-deb
uses: cha-king/[email protected]
with:
package: light-controller
package_root: light-controller_${{ github.ref_name }}_armv6l
maintainer: Charlie King
version: ${{ github.ref_name }}
arch: armv6l
desc: Simple MQTT light controller

- name: Upload deb package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./light-controller
asset_name: light-controller
asset_path: ./${{ steps.package-deb.outputs.file_name }}
asset_name: ${{ steps.package-deb.outputs.file_name }}
asset_content_type: application/octet-stream
11 changes: 11 additions & 0 deletions light-controller.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Simple MQTT light controller
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/light-controller

[Install]
WantedBy=multi-user.target

0 comments on commit 3d53d5d

Please sign in to comment.