Skip to content

Commit

Permalink
feat(release): adding multi arch
Browse files Browse the repository at this point in the history
  • Loading branch information
atbore-phx committed Mar 11, 2024
1 parent ab14ccc commit 8340ce8
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 21 deletions.
87 changes: 75 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,56 @@ permissions:
id-token: write

jobs:
release:
release-ha:
runs-on: ubuntu-latest
strategy:
matrix:
goarch:
- amd64_v1
- 386
- arm64
- arm_7
goos:
- linux
include:
- goarch: amd64_v1
haarch: amd64
- goarch: 386
haarch: i386
- goarch: arm64
haarch: aarch64
- goarch: arm_7
haarch: armv7

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
- name: Run GoReleaser

- name: GoReleaser Install
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
install-only: true

- name: GoReleaser Build
run: |
mkdir -p home-assistant/addons/sbam/bin/${{matrix.haarch}}
goreleaser build --clean --single-target --id sbam --output home-assistant/addons/sbam/bin/${{matrix.haarch}}
env:
GOOS: ${{matrix.goos}}
GOARCH: ${{matrix.goarch}}
GOARM: 7
CGO_ENABLED: 0

- name: GoReleaser Publish
run: goreleaser publish
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: copy binary to local ha folder
run: |
mkdir home-assistant/addons/sbam/bin/
cp -v dist/sbam_linux_amd64_v1/bin/sbam home-assistant/addons/sbam/bin/

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -42,6 +71,40 @@ jobs:
uses: home-assistant/[email protected]
with:
args: |
--amd64 \
--target /data/home-assistant/addons/sbam \
--addon
--${{matrix.haarch}} \
--target /data/home-assistant/addons/sbam/${{matrix.haarch}} \
--addon
release-os:
runs-on: ubuntu-latest
strategy:
matrix:
goarch:
- amd64_v1
- 386
- arm64
- arm_7
goos:
- windows
- darwin
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4

- name: GoReleaser Build
run: goreleaser build --clean --single-target --id sbam
env:
GOOS: ${{matrix.goos}}
GOARCH: ${{matrix.goarch}}
GOARM: 7
CGO_ENABLED: 0

- name: GoReleaser Publish
run: goreleaser publish
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
6 changes: 0 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ before:
hooks:
- go mod tidy

builds:
- id: "sbam"
binary: bin/sbam
env:
- CGO_ENABLED=0

changelog:
sort: asc
filters:
Expand Down
9 changes: 6 additions & 3 deletions home-assistant/addons/sbam/config.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "sbam",
"version": "latest",
"version": "1.3.1",
"slug": "sbam",
"init": "false",
"description": "Smart Battery Avanced Manager",
"arch": [
"amd64"
"amd64",
"i386",
"armv7",
"aarch64"
],
"url": "https://github.com/atbore-phx/sbam",
"image": "ghcr.io/atbore-phx/ha-sbam",
"image": "ghcr.io/atbore-phx/ha-{arch}-sbam",
"options": {
"url": "https://api.solcast.com.au/rooftop_sites/<YOUR-SITE>/forecasts?format=json",
"apikey": "",
Expand Down

0 comments on commit 8340ce8

Please sign in to comment.