mirror of
https://github.com/Chipazawra/v8-1c-cluster-pde.git
synced 2024-12-25 01:32:38 +02:00
release workflow
This commit is contained in:
parent
70d4d252d5
commit
080611a6f7
76
.github/workflows/release-assets.yml
vendored
76
.github/workflows/release-assets.yml
vendored
@ -1,76 +0,0 @@
|
||||
# This script is provided by github.com/bool64/dev.
|
||||
|
||||
# This script uploads application binaries as GitHub release assets.
|
||||
name: release-assets
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Upload Release Assets
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build artifacts
|
||||
run: |
|
||||
make release-assets
|
||||
- name: Upload linux_amd64.tar.gz
|
||||
if: hashFiles('linux_amd64.tar.gz') != ''
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./linux_amd64.tar.gz
|
||||
asset_name: linux_amd64.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload linux_arm64.tar.gz
|
||||
if: hashFiles('linux_arm64.tar.gz') != ''
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./linux_arm64.tar.gz
|
||||
asset_name: linux_arm64.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload linux_arm.tar.gz
|
||||
if: hashFiles('linux_arm.tar.gz') != ''
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./linux_arm.tar.gz
|
||||
asset_name: linux_arm.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload darwin_amd64.tar.gz
|
||||
if: hashFiles('darwin_amd64.tar.gz') != ''
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./darwin_amd64.tar.gz
|
||||
asset_name: darwin_amd64.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload darwin_arm64.tar.gz
|
||||
if: hashFiles('darwin_arm64.tar.gz') != ''
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./darwin_arm64.tar.gz
|
||||
asset_name: darwin_arm64.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload windows_amd64.zip
|
||||
if: hashFiles('windows_amd64.zip') != ''
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./windows_amd64.zip
|
||||
asset_name: windows_amd64.zip
|
||||
asset_content_type: application/zip
|
17
.github/workflows/release.yml
vendored
Normal file
17
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# .github/workflows/release.yaml
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
release-linux-amd64:
|
||||
name: release linux/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wangyoucao577/go-release-action@v1.22
|
||||
with:
|
||||
github_token: ${{ secrets.RELEASE_TOKEN }}
|
||||
goos: linux
|
||||
goarch: amd64
|
47
Makefile
47
Makefile
@ -1,37 +1,26 @@
|
||||
export CGO_ENABLED = 0
|
||||
BUILD_LDFLAGS="-s -w"
|
||||
|
||||
#GOLANGCI_LINT_VERSION := "v1.40.1" # Optional configuration to pinpoint golangci-lint version.
|
||||
|
||||
# The head of Makefile determines location of dev-go to include standard targets.
|
||||
GO ?= go
|
||||
export GO111MODULE = on
|
||||
|
||||
ifneq "$(GOFLAGS)" ""
|
||||
$(info GOFLAGS: ${GOFLAGS})
|
||||
endif
|
||||
# Override in app Makefile to add custom ldflags, example BUILD_LDFLAGS="-s -w"
|
||||
BUILD_LDFLAGS ?= ""
|
||||
|
||||
ifneq "$(wildcard ./vendor )" ""
|
||||
$(info Using vendor)
|
||||
modVendor = -mod=vendor
|
||||
ifeq (,$(findstring -mod,$(GOFLAGS)))
|
||||
export GOFLAGS := ${GOFLAGS} ${modVendor}
|
||||
endif
|
||||
ifneq "$(wildcard ./vendor/github.com/bool64/dev)" ""
|
||||
DEVGO_PATH := ./vendor/github.com/bool64/dev
|
||||
endif
|
||||
endif
|
||||
# Override in app Makefile to control build target, example BUILD_PKG=./cmd/my-app
|
||||
BUILD_PKG ?= .
|
||||
|
||||
ifeq ($(DEVGO_PATH),)
|
||||
DEVGO_PATH := $(shell GO111MODULE=on $(GO) list ${modVendor} -f '{{.Dir}}' -m github.com/bool64/dev)
|
||||
ifeq ($(DEVGO_PATH),)
|
||||
$(info Module github.com/bool64/dev not found, downloading.)
|
||||
DEVGO_PATH := $(shell export GO111MODULE=on && $(GO) mod tidy && $(GO) list -f '{{.Dir}}' -m github.com/bool64/dev)
|
||||
endif
|
||||
endif
|
||||
# Override in app Makefile to control build artifact destination.
|
||||
BUILD_DIR ?= ./bin
|
||||
|
||||
export CGO_ENABLED ?= 0
|
||||
|
||||
-include ./release-assets.mk
|
||||
RELEASE_TARGETS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/arm32 windows/amd64
|
||||
|
||||
## Build and compress binaries for release assets.
|
||||
release-assets:
|
||||
@echo "Release targets: $(RELEASE_TARGETS)"
|
||||
@[[ $(RELEASE_TARGETS) == *"darwin/amd64"* ]] && (echo "Building Darwin AMD64 binary" && GOOS=darwin GOARCH=amd64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../darwin_amd64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"darwin/arm64"* ]] && (echo "Building Darwin ARM64 binary" && GOOS=darwin GOARCH=arm64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../darwin_arm64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"linux/amd64"* ]] && (echo "Building Linux AMD64 binary" && GOOS=linux GOARCH=amd64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../linux_amd64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"linux/arm64"* ]] && (echo "Building Linux ARM64 binary" && GOOS=linux GOARCH=arm64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../linux_arm64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"linux/arm32"* ]] && (echo "Building Linux ARM binary" && GOOS=linux GOARCH=arm $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../linux_arm.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"windows/amd64"* ]] && (echo "Building Windows AMD64 binary" && GOOS=windows GOARCH=amd64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && zip -9 -j ../windows_amd64.zip * && rm *) || :
|
||||
|
||||
# Add your custom targets here.
|
||||
.PHONY: release-assets
|
@ -1,26 +0,0 @@
|
||||
GO ?= go
|
||||
|
||||
# Override in app Makefile to add custom ldflags, example BUILD_LDFLAGS="-s -w"
|
||||
BUILD_LDFLAGS ?= ""
|
||||
|
||||
# Override in app Makefile to control build target, example BUILD_PKG=./cmd/my-app
|
||||
BUILD_PKG ?= .
|
||||
|
||||
# Override in app Makefile to control build artifact destination.
|
||||
BUILD_DIR ?= ./bin
|
||||
|
||||
export CGO_ENABLED ?= 0
|
||||
|
||||
RELEASE_TARGETS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/arm32 windows/amd64
|
||||
|
||||
## Build and compress binaries for release assets.
|
||||
release-assets:
|
||||
@echo "Release targets: $(RELEASE_TARGETS)"
|
||||
@[[ $(RELEASE_TARGETS) == *"darwin/amd64"* ]] && (echo "Building Darwin AMD64 binary" && GOOS=darwin GOARCH=amd64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../darwin_amd64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"darwin/arm64"* ]] && (echo "Building Darwin ARM64 binary" && GOOS=darwin GOARCH=arm64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../darwin_arm64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"linux/amd64"* ]] && (echo "Building Linux AMD64 binary" && GOOS=linux GOARCH=amd64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../linux_amd64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"linux/arm64"* ]] && (echo "Building Linux ARM64 binary" && GOOS=linux GOARCH=arm64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../linux_arm64.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"linux/arm32"* ]] && (echo "Building Linux ARM binary" && GOOS=linux GOARCH=arm $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && tar zcvf ../linux_arm.tar.gz * && rm *) || :
|
||||
@[[ $(RELEASE_TARGETS) == *"windows/amd64"* ]] && (echo "Building Windows AMD64 binary" && GOOS=windows GOARCH=amd64 $(GO) build -ldflags "$(shell bash $(DEVGO_SCRIPTS)/version-ldflags.sh && echo $(BUILD_LDFLAGS))" -o $(BUILD_DIR)/ $(BUILD_PKG) && cd $(BUILD_DIR) && zip -9 -j ../windows_amd64.zip * && rm *) || :
|
||||
|
||||
.PHONY: release-assets
|
Loading…
Reference in New Issue
Block a user