Add release pipeline
parent
161ec76eb9
commit
bbf29104fe
|
@ -12,17 +12,13 @@ jobs:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: ^1.15
|
go-version: ^1.15
|
||||||
- name: Check out code
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make build
|
run: make build-all
|
||||||
- name: Test
|
- name: Test
|
||||||
run: make test-with-coverage
|
run: make test
|
||||||
# - uses: codecov/codecov-action@v1
|
|
||||||
# with:
|
|
||||||
# token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
# files: coverage.out
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Build
|
||||||
|
run: make build-all
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
bin/edgeboxctl-linux-amd64
|
||||||
|
bin/edgeboxctl-linux-arm
|
21
Makefile
21
Makefile
|
@ -6,14 +6,14 @@ BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
||||||
BUILD_DIR = bin
|
BUILD_DIR = bin
|
||||||
|
|
||||||
build-all:
|
build-all:
|
||||||
GOOS=linux GOARCH=amd64 make build
|
make build-arm
|
||||||
|
make build-amd64
|
||||||
|
|
||||||
|
build-arm:
|
||||||
GOOS=linux GOARCH=arm make build
|
GOOS=linux GOARCH=arm make build
|
||||||
|
|
||||||
build-prod:
|
build-amd64:
|
||||||
GOOS=linux GOARCH=arm RELEASE=prod make build
|
GOOS=linux GOARCH=amd64 make build
|
||||||
|
|
||||||
build-cloud:
|
|
||||||
GOOS=linux GOARCH=amd64 RELEASE=cloud make build
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@echo "Building ${GOOS}-${GOARCH}"
|
@echo "Building ${GOOS}-${GOARCH}"
|
||||||
|
@ -22,7 +22,6 @@ build:
|
||||||
-X ${PROJECT}/internal/diagnostics.Commit=${COMMIT} \
|
-X ${PROJECT}/internal/diagnostics.Commit=${COMMIT} \
|
||||||
-X ${PROJECT}/internal/diagnostics.BuildDate=${BUILD_DATE}" \
|
-X ${PROJECT}/internal/diagnostics.BuildDate=${BUILD_DATE}" \
|
||||||
-o bin/edgeboxctl-${GOOS}-${GOARCH} ${PROJECT}/cmd/edgeboxctl
|
-o bin/edgeboxctl-${GOOS}-${GOARCH} ${PROJECT}/cmd/edgeboxctl
|
||||||
cp ./bin/edgeboxctl-${GOOS}-${GOARCH} ./bin/edgeboxctl
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf ${BUILD_DIR}
|
rm -rf ${BUILD_DIR}
|
||||||
|
@ -34,15 +33,15 @@ test:
|
||||||
test-with-coverage:
|
test-with-coverage:
|
||||||
go test -tags=unit -timeout=600s -v ./... -coverprofile=coverage.out
|
go test -tags=unit -timeout=600s -v ./... -coverprofile=coverage.out
|
||||||
|
|
||||||
install-cloud: build-cloud
|
install-cloud: build-amd64
|
||||||
cp ./bin/edgeboxctl /usr/local/bin/edgeboxctl
|
cp ./bin/edgeboxctl-amd64 /usr/local/bin/edgeboxctl
|
||||||
cp ./edgeboxctl/edgeboxctl.service /lib/systemd/system/edgeboxctl.service
|
cp ./edgeboxctl/edgeboxctl.service /lib/systemd/system/edgeboxctl.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
@echo "Edgeboxctl installed successfully"
|
@echo "Edgeboxctl installed successfully"
|
||||||
@echo "To start edgeboxctl run: systemctl start edgeboxctl"
|
@echo "To start edgeboxctl run: systemctl start edgeboxctl"
|
||||||
|
|
||||||
install-prod: build-prod
|
install-prod: build-arm
|
||||||
cp ./bin/edgeboxctl /usr/local/bin/edgeboxctl
|
cp ./bin/edgeboxctl-arm /usr/local/bin/edgeboxctl
|
||||||
cp ./edgeboxctl/edgeboxctl.service /lib/systemd/system/edgeboxctl.service
|
cp ./edgeboxctl/edgeboxctl.service /lib/systemd/system/edgeboxctl.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
@echo "Edgeboxctl installed successfully"
|
@echo "Edgeboxctl installed successfully"
|
||||||
|
|
Loading…
Reference in New Issue