Add release pipeline

release
Malachi Soord 2023-03-14 23:30:44 +01:00
parent 161ec76eb9
commit bbf29104fe
No known key found for this signature in database
GPG Key ID: C61BEBD6CC542333
3 changed files with 42 additions and 26 deletions

View File

@ -12,17 +12,13 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.15
- name: Check out code
uses: actions/checkout@v3
- name: Build
run: make build
- name: Test
run: make test-with-coverage
# - uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: coverage.out
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.15
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: make build-all
- name: Test
run: make test

21
.github/workflows/publish.yml vendored 100644
View File

@ -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

View File

@ -6,14 +6,14 @@ BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
BUILD_DIR = bin
build-all:
GOOS=linux GOARCH=amd64 make build
make build-arm
make build-amd64
build-arm:
GOOS=linux GOARCH=arm make build
build-prod:
GOOS=linux GOARCH=arm RELEASE=prod make build
build-cloud:
GOOS=linux GOARCH=amd64 RELEASE=cloud make build
build-amd64:
GOOS=linux GOARCH=amd64 make build
build:
@echo "Building ${GOOS}-${GOARCH}"
@ -22,7 +22,6 @@ build:
-X ${PROJECT}/internal/diagnostics.Commit=${COMMIT} \
-X ${PROJECT}/internal/diagnostics.BuildDate=${BUILD_DATE}" \
-o bin/edgeboxctl-${GOOS}-${GOARCH} ${PROJECT}/cmd/edgeboxctl
cp ./bin/edgeboxctl-${GOOS}-${GOARCH} ./bin/edgeboxctl
clean:
rm -rf ${BUILD_DIR}
@ -34,15 +33,15 @@ test:
test-with-coverage:
go test -tags=unit -timeout=600s -v ./... -coverprofile=coverage.out
install-cloud: build-cloud
cp ./bin/edgeboxctl /usr/local/bin/edgeboxctl
install-cloud: build-amd64
cp ./bin/edgeboxctl-amd64 /usr/local/bin/edgeboxctl
cp ./edgeboxctl/edgeboxctl.service /lib/systemd/system/edgeboxctl.service
systemctl daemon-reload
@echo "Edgeboxctl installed successfully"
@echo "To start edgeboxctl run: systemctl start edgeboxctl"
install-prod: build-prod
cp ./bin/edgeboxctl /usr/local/bin/edgeboxctl
install-prod: build-arm
cp ./bin/edgeboxctl-arm /usr/local/bin/edgeboxctl
cp ./edgeboxctl/edgeboxctl.service /lib/systemd/system/edgeboxctl.service
systemctl daemon-reload
@echo "Edgeboxctl installed successfully"