Include image files in release assets (#583)
This commit is contained in:
parent
33e4058b93
commit
fdc1d81fbb
3 changed files with 74 additions and 14 deletions
44
.github/workflows/build.yml
vendored
44
.github/workflows/build.yml
vendored
|
|
@ -53,8 +53,8 @@ jobs:
|
|||
run: make test
|
||||
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
dockerlatest:
|
||||
name: Publish :latest
|
||||
if: |
|
||||
startsWith(github.ref, 'refs/heads/master')
|
||||
&& ! contains(github.head_ref, 'refs/heads/chore/')
|
||||
|
|
@ -80,8 +80,8 @@ jobs:
|
|||
run: make publish-latest
|
||||
|
||||
|
||||
release:
|
||||
name: Release
|
||||
dockerrelease:
|
||||
name: Publish :release
|
||||
if: "startsWith(github.ref, 'refs/tags')"
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -105,7 +105,41 @@ jobs:
|
|||
- name: Publish
|
||||
run: make publish-images
|
||||
|
||||
- name: Release
|
||||
|
||||
release:
|
||||
name: Release
|
||||
if: "startsWith(github.ref, 'refs/tags')"
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
**/node_modules
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.14
|
||||
id: go
|
||||
|
||||
- name: Build Image
|
||||
run: make image
|
||||
|
||||
- name: Build Root Filesystem
|
||||
run: make image-rootfs
|
||||
|
||||
- name: Create Github Release
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ archives:
|
|||
format: zip
|
||||
files:
|
||||
- evcc.dist.yaml
|
||||
- evcc_*.image.gz
|
||||
- evcc_*.rootfs.gz
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
|
|
|
|||
42
Makefile
42
Makefile
|
|
@ -1,14 +1,23 @@
|
|||
.PHONY: default clean install lint test assets build binaries test-release release publish-testing publish-latest publish-images
|
||||
.PHONY: default clean install lint test assets build binaries test-release release
|
||||
.PHONY: publish-testing publish-latest publish-images
|
||||
.PHONY: image image-rootfs image-update
|
||||
|
||||
# build vars
|
||||
TAG_NAME := $(shell test -d .git && git describe --abbrev=0 --tags)
|
||||
SHA := $(shell test -d .git && git rev-parse --short HEAD)
|
||||
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
|
||||
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
||||
|
||||
IMAGE := andig/evcc
|
||||
ALPINE := 3.12
|
||||
# docker
|
||||
DOCKER_IMAGE := andig/evcc
|
||||
ALPINE_VERSION := 3.12
|
||||
TARGETS := arm.v6,arm.v8,amd64
|
||||
|
||||
# image
|
||||
IMAGE_FILE := evcc_$(TAG_NAME).image
|
||||
IMAGE_ROOTFS := evcc_$(TAG_NAME).rootfs
|
||||
IMAGE_OPTIONS := -hostname evcc -http_port 8080 github.com/gokrazy/serial-busybox github.com/andig/brokenglass github.com/andig/evcc
|
||||
|
||||
default: clean install npm assets lint test build
|
||||
|
||||
clean:
|
||||
|
|
@ -50,15 +59,30 @@ release:
|
|||
|
||||
publish-testing:
|
||||
@echo Version: $(VERSION) $(BUILD_DATE)
|
||||
seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE) \
|
||||
--image-name $(IMAGE) -v "testing" --targets=arm.v6,amd64
|
||||
seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE_VERSION) \
|
||||
--image-name $(DOCKER_IMAGE) -v "testing" --targets=arm.v6,amd64
|
||||
|
||||
publish-latest:
|
||||
@echo Version: $(VERSION) $(BUILD_DATE)
|
||||
seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE) \
|
||||
--image-name $(IMAGE) -v "latest" --targets=$(TARGETS)
|
||||
seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE_VERSION) \
|
||||
--image-name $(DOCKER_IMAGE) -v "latest" --targets=$(TARGETS)
|
||||
|
||||
publish-images:
|
||||
@echo Version: $(VERSION) $(BUILD_DATE)
|
||||
seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE) \
|
||||
--image-name $(IMAGE) -v "latest" -v "$(TAG_NAME)" --targets=$(TARGETS)
|
||||
seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE_VERSION) \
|
||||
--image-name $(DOCKER_IMAGE) -v "latest" -v "$(TAG_NAME)" --targets=$(TARGETS)
|
||||
|
||||
image:
|
||||
go get github.com/gokrazy/tools/cmd/gokr-packer
|
||||
gokr-packer -overwrite=$(IMAGE_FILE) -target_storage_bytes=1258299392 $(IMAGE_OPTIONS)
|
||||
|
||||
# create filesystem
|
||||
loop=$$(sudo losetup --find --show -P $(IMAGE_FILE)); sudo mkfs.ext4 $${loop}p4
|
||||
gzip -f -k $(IMAGE_FILE)
|
||||
|
||||
image-rootfs:
|
||||
gokr-packer -overwrite_root=$(IMAGE_ROOTFS) $(IMAGE_OPTIONS)
|
||||
gzip -f -k $(IMAGE_ROOTFS)
|
||||
|
||||
image-update:
|
||||
gokr-packer -update yes $(IMAGE_OPTIONS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue